javascript - Responsive jQuery script load -
i have script fades in logo based on scroll position (based on daniel stuart's solution: http://danielstuart.ie/2010/09/20/my-jquery-mini-logo/ )
<script> var $scrolled = new boolean(false); jquery.noconflict(); jquery(window).scroll(function () { position = jquery(window).scrolltop(); if(position >=250 && $scrolled == false){ $scrolled = new boolean(true); jquery('.small-logo').fadein('normal', function() { }); }else if(position <250 && $scrolled == true){ $scrolled = new boolean(false); jquery('.small-logo').fadeout('normal', function() { }); } }); </script>
the issue site responsive , don't want load when browser width less 768px. how can make happen, or not happen were?
jquery(window).scroll(function () { if (jquery(window).width() > 768) { position = jquery(window).scrolltop(); if(position >=250 && $scrolled == false){ $scrolled = new boolean(true); jquery('.small-logo').fadein('normal', function() { }); }else if(position <250 && $scrolled == true){ $scrolled = new boolean(false); jquery('.small-logo').fadeout('normal', function() { }); } } });
Comments
Post a Comment