Pregunta

i'm using sticky.js now i wanna use this when min-width sets to 768px in other words i don't want sticky.js works in mobiles or devices that has max-width 768px .

i use this jquery code to use sticky-js

jQuery(document).ready(function(){
    jQuery("#header").sticky({
        className : 'sticky-header' ,
        topSpacing : -45
    });
}); 

if you need more details let me know

¿Fue útil?

Solución

Use a condition, and check whatever element has the min-width style set

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

    if ( min_width > 768 ) {
        $("#header").sticky({
            className : 'sticky-header' ,
            topSpacing : -45
        });
    }
}); 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top