diff --git a/js/script.js b/js/script.js index 2144717..c1491aa 100644 --- a/js/script.js +++ b/js/script.js @@ -25,7 +25,7 @@ jQuery(function($) { // Show and hide the scroll to top link based on scroll position scrollElem.hide(); - $(window).scroll(function () { + $(window).on('scroll',function () { var scrollTop = $(document).scrollTop(); if ( scrollTop > upperLimit ) { $(scrollElem).stop().fadeTo(300, 1); // fade back in @@ -35,7 +35,7 @@ jQuery(function($) { }); // Scroll to top animation on click - $(scrollElem).click(function(){ + $(scrollElem).on('click',function(){ $('html, body').animate({scrollTop:0}, scrollSpeed, scrollStyle ); return false; }); @@ -45,14 +45,13 @@ jQuery(function($) { * * ****************************************************/ - $('a[href*="#"]:not([href="#"]):not([href^="#tab"]):not([href^="#collapse"])').click(function() + $('a[href*="#"]:not([href="#"]):not([href^="#tab"]):not([href^="#collapse"])').on('click',function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname) { var target = $(this.hash), - headerHeight = $(".primary-header").height() + 5; // Get fixed header height target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); @@ -71,4 +70,4 @@ jQuery(function($) { * * ****************************************************/ -}); \ No newline at end of file +}); diff --git a/js/script.min.js b/js/script.min.js index 03f56a8..c39f568 100644 --- a/js/script.min.js +++ b/js/script.min.js @@ -1 +1 @@ -jQuery.noConflict(),jQuery(function(o){var t=100,e=o("a#scroll-to-top"),n=600,a="swing";e.hide(),o(window).scroll(function(){var n=o(document).scrollTop();n>t?o(e).stop().fadeTo(300,1):o(e).stop().fadeTo(300,0)}),o(e).click(function(){return o("html, body").animate({scrollTop:0},n,a),!1}),o('a[href*="#"]:not([href="#"]):not([href^="#tab"]):not([href^="#collapse"])').click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")||location.hostname==this.hostname){var t=o(this.hash);o(".primary-header").height()+5;if(t=t.length?t:o("[name="+this.hash.slice(1)+"]"),t.length)return o("html,body").animate({scrollTop:t.offset().top},n,a),!1}})}); \ No newline at end of file +jQuery.noConflict(),jQuery((function(o){var t=o("a#scroll-to-top"),n="swing";t.hide(),o(window).on("scroll",(function(){o(document).scrollTop()>100?o(t).stop().fadeTo(300,1):o(t).stop().fadeTo(300,0)})),o(t).on("click",(function(){return o("html, body").animate({scrollTop:0},600,n),!1})),o('a[href*="#"]:not([href="#"]):not([href^="#tab"]):not([href^="#collapse"])').on("click",(function(){var t;if((location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")||location.hostname==this.hostname)&&(t=(t=o(this.hash)).length?t:o("[name="+this.hash.slice(1)+"]")).length)return o("html,body").animate({scrollTop:t.offset().top},600,n),!1}))}));