Reputation: 153
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 ?
Upvotes: 0
Views: 37
Reputation: 307
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.
Upvotes: 1