Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Jquery & Vanilla

edited March 2012 in Vanilla 2.0 - 2.8

Hi guys,

Can I not use any Jquery with Vanilla? Everytime I try to add something Jquery wise it 'Bonks' on me. I'm trying to use the Nivo Slider. Does anyone know a work around or another type of slider that works?

Thanks,
Amphios

Best Answer

  • Options
    x00x00 MVP
    Answer ✓

    I already said the vanilla already uses jquery so there is no need to add it twice.

    secondly you are using a smartly template in smarty templates use curly brackets. This is goign to to cause a conflict. To escape wrap in {literal} like so:

    {literal} 
       <script type="text/javascript">
    
       </script>
    {/literal}

    However I don't see the point having it embedded you might as well have it in a file and src it. It just creates clutter. put it in themes/YourTheme/js/custom.js and it will show up immediately.

    That is becuase vanilla has a Head asset, adding title, charset. you can set them via configuration. You can add external script through theme hooks

    in themes/YourTheme/class.yourthemehooks.php put

    class YourThemeThemeHooks implements Gdn_IPlugin {
        public function Base_Render_Before($Sender) { 
            if(is_object($Sender->Head)){
                $Sender->Head->AddScript('http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js');
            }
        }
    }
    

    grep is your friend.

Answers

  • Options
    422422 Developer MVP
    edited March 2012

    We use a slider on one of our themes, forget which one though lol, i think its press

    There was an error rendering this rich post.

  • Options

    So.. what you're saying is you can use sliders as long as they're the wordpress version? Nivo has a wordpress version.

  • Options
    422422 Developer MVP
    edited March 2012

    Nope.

    You can do whatever you want, but u gotta get ur hands dirty. I dont use wormpress

    Goto vanillaskins check out press theme.

    There was an error rendering this rich post.

  • Options

    I've had a look at it. Every time I even try to use any JQ it 'Bonks' on me. Am I missing an important step?

  • Options
    peregrineperegrine MVP
    edited March 2012

    Are you loading the jquery script you want to use? Can you see that it is loaded.
    You might consider posting some of your script, and are you using the current version of vanilla and how and where you are adding it? These are some of the questions that come to mind that might get you some answers to solving your issue.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    I'll try get the main part of the template working. I'll leave the slideshow till last. I'm in preview mode at the minute.

  • Options
    x00x00 MVP
    edited March 2012

    the server doesn't bonk because of jquery, it just serve resource like javascript that includes jquery, which after all is client side code.

    vanilla comes with jquery, you can do anything you can do with jquery.

    grep is your friend.

  • Options

    When Vanilla bonks on you, apply the necessary setting(s) in config.php so you get a better error page.

    Search in the forums for which settings to change

    There was an error rendering this rich post.

  • Options
    edited March 2012

    It wont let me do any JQ. As soon as I add any, it bonks on me. Ive tried about 20 different ones now.

    Take a look at what I added.
    http://uploadir.com/u/53d1n2

  • Options
    x00x00 MVP
    Answer ✓

    I already said the vanilla already uses jquery so there is no need to add it twice.

    secondly you are using a smartly template in smarty templates use curly brackets. This is goign to to cause a conflict. To escape wrap in {literal} like so:

    {literal} 
       <script type="text/javascript">
    
       </script>
    {/literal}

    However I don't see the point having it embedded you might as well have it in a file and src it. It just creates clutter. put it in themes/YourTheme/js/custom.js and it will show up immediately.

    That is becuase vanilla has a Head asset, adding title, charset. you can set them via configuration. You can add external script through theme hooks

    in themes/YourTheme/class.yourthemehooks.php put

    class YourThemeThemeHooks implements Gdn_IPlugin {
        public function Base_Render_Before($Sender) { 
            if(is_object($Sender->Head)){
                $Sender->Head->AddScript('http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js');
            }
        }
    }
    

    grep is your friend.

  • Options

    amphios said:
    It wont let me do any JQ. As soon as I add any, it bonks on me.

    When Vanilla bonks on you, apply the necessary setting(s) in config.php so you get a > better error page.

    Search in the forums for which settings to change

    Plate => Head => bonk bonk bonk

    There was an error rendering this rich post.

  • Options
    edited March 2012

    NEVERMIND! I was missing a /demo/ in the rel. Thanks for everyones help. :)

Sign In or Register to comment.