jQuery Conflict or

i'm using sticky.js plugin and now i wanna use it when width greater that 768px so i use :

jQuery(function($){
    var min_width = parseInt( $('body').css('min-width'), 10 );

    if ( min_width > 768 ) {
        $("#header").sticky({
            className : 'sticky-header' ,
            topSpacing : -45
        });
    }
});

but it dosn't work for me . i think that there is jQuery conflict because codes looks correct . what should i do ?

live demo

Solutions

Use

var min_width = $(window).width();

instead of

var min_width = parseInt( $('body').css('min-width'), 10 );

min-width will give you only the min-width you defined in you css file, not the actual size of the body / window.

Similar questions

Multiple jQuery conflict unsure of why
I am trying to use the same image fader in two different spots on my testing site. The one in the top banner works, and the one in the furthest right sidebar kind of worksThey both now do not work. However I believe that the answer below is more or less on the right track and it is a Wordpress "quirk" that is at a fault and I just need a workaround...
"Conflict" with jQuery (or its plugins)?
I've been working on localhost and everything looks fine but then when I uploaded my Wordpress theme online, all of the jQuery plugin functions are undefined! One solution that worked (which I haven't tested a lot so I still don't know if it will work in the long run) is to import the javascript file from the plugin's main website or github page. I...
Is there some jQuery conflict here?
I'm customizing a wordpress theme called Accordium, and I have decided to add infinite scroll to it using a wordpress plugin called pbd-ajax-load-posts. In the theme, when you click on a post in archive view, an accordian animation plays by standard. The problem is, the plugin fails to render the default accordion style of posts in the archive when...
Blip Slideshow plugin Mootools/jQuery conflict
This particular site uses the Blip Slideshow plug in (because it's fed by a Picasa web rss feed) and also a jQuery powered slider. The plug in inserts the Mootools script links ahead of the jQuery ones in the header which breaks the slider. I can push the Mootools links to the footer but then Blip doesn't work. The script that calls the slider is a...
jquery conflict with widget page
I'm trying to create a widget plugin that uses a jQuery code to show/hide divs in the widget form based on the selected option of a select drop menu. The jQuery code I'm trying to implement is working fine everywhere else, but in the widgets page it makes the widgets not working (not expandable or dragable). This is my code on jsfiddle: http://jsfi...
Possible jquery / library conflict in plugin usage
I am using the free version of the plugin: WP Feedback & Survey Manager but for some reasons the tab style is not rendered, and I guess it's for a javascript/jquery problem, eventhough I don't get any console errors. This is the plugin public url I installed: http://www.riccardo.it/newtech/questionnaire/ And here it is how it should look like (...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.