WordPress.org

Ready to get started?Download WordPress

Forums

Responsive
Modify script with Modernizr's touch/no-touch (2 posts)

  1. hrrubin
    Member
    Posted 7 months ago #

    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'});
            }
        });
     });
  2. hrrubin
    Member
    Posted 7 months ago #

    Will no one help?

Reply

You must log in to post.

About this Theme

About this Topic