From 2c17dcb0f157481e84014d718f3954c684c8be55 Mon Sep 17 00:00:00 2001 From: fefoweb Date: Wed, 25 Oct 2017 23:48:43 +0200 Subject: [PATCH] - remove deprecation showing up in conjunction with jquery.migrate: JQMIGRATE: jQuery.fn.scroll() event shorthand is deprecated, jQuery.fn.click() event shorthand is deprecated - version to 2.4.2 --- .gitignore | 1 + CHANGELOG.md | 5 +++++ dist/jquery.scrollUp.js | 6 +++--- dist/jquery.scrollUp.min.js | 4 ++-- package.json | 2 +- src/jquery.scrollUp.js | 4 ++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index f4c8aa9..f58f266 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # System files .DS_Store +.idea # Node modules node_modules diff --git a/CHANGELOG.md b/CHANGELOG.md index 43a3606..d4ea65e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2.4.2 +- remove deprecation showing up in conjunction with jquery.migrate + * JQMIGRATE: jQuery.fn.scroll() event shorthand is deprecated + * JQMIGRATE: jQuery.fn.click() event shorthand is deprecated + ## 2.4.1 - Update jQuery dependency diff --git a/dist/jquery.scrollUp.js b/dist/jquery.scrollUp.js index 191f16e..abcbfb8 100644 --- a/dist/jquery.scrollUp.js +++ b/dist/jquery.scrollUp.js @@ -1,5 +1,5 @@ /*! - * scrollup v2.4.1 + * scrollup v2.4.2 * Url: http://markgoodyear.com/labs/scrollup/ * Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com * License: MIT @@ -95,7 +95,7 @@ } // Scroll function - scrollEvent = $(window).scroll(function () { + scrollEvent = $(window).on('scroll', function () { if ($(window).scrollTop() > scrollDis) { if (!triggerVisible) { $self[animIn](animSpeed); @@ -120,7 +120,7 @@ } // To the top - $self.click(function (e) { + $self.on('click', function (e) { e.preventDefault(); $('html, body').animate({ diff --git a/dist/jquery.scrollUp.min.js b/dist/jquery.scrollUp.min.js index aa79e47..bb08833 100644 --- a/dist/jquery.scrollUp.min.js +++ b/dist/jquery.scrollUp.min.js @@ -1,7 +1,7 @@ /*! - * scrollup v2.4.1 + * scrollup v2.4.2 * Url: http://markgoodyear.com/labs/scrollup/ * Copyright (c) Mark Goodyear — @markgdyr — http://markgoodyear.com * License: MIT */ -!function(l,o,e){"use strict";l.fn.scrollUp=function(o){l.data(e.body,"scrollUp")||(l.data(e.body,"scrollUp",!0),l.fn.scrollUp.init(o))},l.fn.scrollUp.init=function(r){var s,t,c,i,n,a,d,p=l.fn.scrollUp.settings=l.extend({},l.fn.scrollUp.defaults,r),f=!1;switch(d=p.scrollTrigger?l(p.scrollTrigger):l("",{id:p.scrollName,href:"#top"}),p.scrollTitle&&d.attr("title",p.scrollTitle),d.appendTo("body"),p.scrollImg||p.scrollTrigger||d.html(p.scrollText),d.css({display:"none",position:"fixed",zIndex:p.zIndex}),p.activeOverlay&&l("
",{id:p.scrollName+"-active"}).css({position:"absolute",top:p.scrollDistance+"px",width:"100%",borderTop:"1px dotted"+p.activeOverlay,zIndex:p.zIndex}).appendTo("body"),p.animation){case"fade":s="fadeIn",t="fadeOut",c=p.animationSpeed;break;case"slide":s="slideDown",t="slideUp",c=p.animationSpeed;break;default:s="show",t="hide",c=0}i="top"===p.scrollFrom?p.scrollDistance:l(e).height()-l(o).height()-p.scrollDistance,n=l(o).scroll(function(){l(o).scrollTop()>i?f||(d[s](c),f=!0):f&&(d[t](c),f=!1)}),p.scrollTarget?"number"==typeof p.scrollTarget?a=p.scrollTarget:"string"==typeof p.scrollTarget&&(a=Math.floor(l(p.scrollTarget).offset().top)):a=0,d.click(function(o){o.preventDefault(),l("html, body").animate({scrollTop:a},p.scrollSpeed,p.easingType)})},l.fn.scrollUp.defaults={scrollName:"scrollUp",scrollDistance:300,scrollFrom:"top",scrollSpeed:300,easingType:"linear",animation:"fade",animationSpeed:200,scrollTrigger:!1,scrollTarget:!1,scrollText:"Scroll to top",scrollTitle:!1,scrollImg:!1,activeOverlay:!1,zIndex:2147483647},l.fn.scrollUp.destroy=function(r){l.removeData(e.body,"scrollUp"),l("#"+l.fn.scrollUp.settings.scrollName).remove(),l("#"+l.fn.scrollUp.settings.scrollName+"-active").remove(),l.fn.jquery.split(".")[1]>=7?l(o).off("scroll",r):l(o).unbind("scroll",r)},l.scrollUp=l.fn.scrollUp}(jQuery,window,document); \ No newline at end of file +!function(l,o,e){"use strict";l.fn.scrollUp=function(o){l.data(e.body,"scrollUp")||(l.data(e.body,"scrollUp",!0),l.fn.scrollUp.init(o))},l.fn.scrollUp.init=function(r){var s,t,c,n,i,a,d,p=l.fn.scrollUp.settings=l.extend({},l.fn.scrollUp.defaults,r),f=!1;switch(d=p.scrollTrigger?l(p.scrollTrigger):l("",{id:p.scrollName,href:"#top"}),p.scrollTitle&&d.attr("title",p.scrollTitle),d.appendTo("body"),p.scrollImg||p.scrollTrigger||d.html(p.scrollText),d.css({display:"none",position:"fixed",zIndex:p.zIndex}),p.activeOverlay&&l("
",{id:p.scrollName+"-active"}).css({position:"absolute",top:p.scrollDistance+"px",width:"100%",borderTop:"1px dotted"+p.activeOverlay,zIndex:p.zIndex}).appendTo("body"),p.animation){case"fade":s="fadeIn",t="fadeOut",c=p.animationSpeed;break;case"slide":s="slideDown",t="slideUp",c=p.animationSpeed;break;default:s="show",t="hide",c=0}n="top"===p.scrollFrom?p.scrollDistance:l(e).height()-l(o).height()-p.scrollDistance,i=l(o).on("scroll",function(){l(o).scrollTop()>n?f||(d[s](c),f=!0):f&&(d[t](c),f=!1)}),p.scrollTarget?"number"==typeof p.scrollTarget?a=p.scrollTarget:"string"==typeof p.scrollTarget&&(a=Math.floor(l(p.scrollTarget).offset().top)):a=0,d.on("click",function(o){o.preventDefault(),l("html, body").animate({scrollTop:a},p.scrollSpeed,p.easingType)})},l.fn.scrollUp.defaults={scrollName:"scrollUp",scrollDistance:300,scrollFrom:"top",scrollSpeed:300,easingType:"linear",animation:"fade",animationSpeed:200,scrollTrigger:!1,scrollTarget:!1,scrollText:"Scroll to top",scrollTitle:!1,scrollImg:!1,activeOverlay:!1,zIndex:2147483647},l.fn.scrollUp.destroy=function(r){l.removeData(e.body,"scrollUp"),l("#"+l.fn.scrollUp.settings.scrollName).remove(),l("#"+l.fn.scrollUp.settings.scrollName+"-active").remove(),l.fn.jquery.split(".")[1]>=7?l(o).off("scroll",r):l(o).unbind("scroll",r)},l.scrollUp=l.fn.scrollUp}(jQuery,window,document); \ No newline at end of file diff --git a/package.json b/package.json index 5c57396..b192d84 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "scrollup", "title": "scrollUp", "description": "A jQuery plugin to create a customisable 'Scroll to top' feature that will work with any website, with ease.", - "version": "2.4.1", + "version": "2.4.2", "homepage": "http://markgoodyear.com/labs/scrollup/", "author": { "name": "Mark Goodyear", diff --git a/src/jquery.scrollUp.js b/src/jquery.scrollUp.js index 445df9b..1c80f8a 100644 --- a/src/jquery.scrollUp.js +++ b/src/jquery.scrollUp.js @@ -89,7 +89,7 @@ } // Scroll function - scrollEvent = $(window).scroll(function () { + scrollEvent = $(window).on('scroll', function () { if ($(window).scrollTop() > scrollDis) { if (!triggerVisible) { $self[animIn](animSpeed); @@ -114,7 +114,7 @@ } // To the top - $self.click(function (e) { + $self.on('click', function (e) { e.preventDefault(); $('html, body').animate({