• I have a menu, that follows, when you scroll. It does not work very well on touch devices. Therefor I want the event to only happen on no-touch devices.

    I’m using the Responsive theme, which have the Modernizr script. How do I modify my code with touch/no-touch?

    This is my script:

    $(document).ready(function() {
       $(window).scroll(function() {
    
           var header = $('#fixed-bar').outerHeight(true);
           console.log(header);
    //this will calculate header's full height, with borders, margins, paddings
           var scrollTopVal = $(this).scrollTop();
            if ( scrollTopVal > header ) {
                $('nav').css({'position':'fixed','top' :'0px', 'border-bottom':'4px solid #ff5454'});
            } else {
                $('nav').css({'position':'absolute','top':'90px', 'border-bottom':'none'});
            }
        });
     });

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Modify script with Modernizr's touch/no-touch’ is closed to new replies.