javascript - js menu anchor doesn't work on mobile -
there anchor on page submenu items. use id in section tag or name in anchor tag both of case doesn't work on mobile version of web site. under submenu items user click no reaction. on desktop version everyting okay.
i not @ js think there problem on scrpt, did miss?
onepagenavinit: function () { var _this = this; if ( typeof $.fn.waypoint != 'undefined' ) { var $menulinks = $('.navigation-list a').not('[href="#"]').filter(function () { return /#\w+/.test(this.href); }), enterhandler = function( that, direction ) { var id = that.id, $item = $('.navigation-list a').filter(function () { return this.href.indexof('#' + that.id) > -1; }); $('.navigation-list .active').removeclass('active'); $item.addclass('active'); // push anchor browser url if ( _this.options.onepagenavhashchange ){ if ( history.pushstate ) { history.pushstate(null, null, '#' + id); }else { _this.log('browser don\'t support history api'); } } }, leavehandler = function ( that, direction ) { var $item = $('.navigation-list a').filter(function () { return this.href.indexof('#' + that.id) > -1; }); $item.removeclass('active'); }; $menulinks.each(function (index) { var href = this.href, anchorid = href.substring(href.indexof('#'), href.length), $block = $(anchorid); if ( $block.length ) { $block.waypoint(function (direction) { if ( direction == 'down' ) { enterhandler( this.element, direction ); } }, { offset: 0 }); $block.waypoint(function (direction) { if ( direction == 'down' ) { leavehandler( this.element, direction ); }else { enterhandler( this.element, direction ); } }, { offset: -$block.outerheight() }); $block.waypoint(function (direction) { if ( direction == 'up' ) { leavehandler( this.element, direction ); } }, { offset: '100%' }); } }); $('body').waypoint(function () { var id = 'hero', $item = $('.navigation-list a[href="#' + id + '"]'); $('.navigation-list .active').removeclass('active'); if ( $item.length ) { $item.addclass('active'); if ( _this.options.onepagenavhashchange ){ if ( history.pushstate ) { history.pushstate(null, null, '#' + id); }else { _this.log('browser don\'t support history api'); } } } }, { offset: -100 }); $('body').on( 'click', 'a[href*="#"]', function (event) { var href = $(this).attr('href'), anchorid = href.substring(href.indexof('#'), href.length); if ( $(this).attr('data-toggle') && $(this).attr('data-toggle').length ) { return; } if ( $(anchorid).length ) { _this.anchorclickhandler(anchorid); return false; } }); }else { this.log( 'can\'t find jquery.waypoint function' ); } },
Comments
Post a Comment