Permalink
Browse files

Closes #98

both() now handles nulls correctly
Updated jquery requirement to >= 1.4
  • Loading branch information...
1 parent 5b80177 commit 025405d6bc60e810130ba33a63acc37fe32cdadc @flesler committed Nov 20, 2014
Showing with 46 additions and 42 deletions.
  1. +2 −2 bower.json
  2. +4 −0 changes.txt
  3. +31 −31 composer.json
  4. +3 −3 jquery.scrollTo.js
  5. +2 −2 jquery.scrollTo.min.js
  6. +2 −2 package.json
  7. +2 −2 scrollTo.jquery.json
View
@@ -1,6 +1,6 @@
{
"name": "jquery.scrollTo",
- "version": "1.4.13",
+ "version": "1.4.14",
"description": "Easy element scrolling using jQuery.",
"homepage": "https://github.com/flesler/jquery.scrollTo",
"main": [
@@ -14,7 +14,7 @@
"composer.json"
],
"dependencies": {
- "jquery": ">=1.8"
+ "jquery": ">=1.4"
},
"keywords": [
"browser", "animated", "animation",
View
@@ -1,3 +1,7 @@
+1.4.14
+[Misc]
+- Internal both() function will handle nulls correctly
+
1.4.13
[Misc]
- Support for CommonJS / NPM added by durango
View
@@ -1,32 +1,32 @@
-{
- "name": "flesler/jquery.scrollto",
- "description": "Easy element scrolling using jQuery.",
- "keywords": [
- "browser", "animated", "animation",
- "scrolling", "scroll", "links", "anchors"
- ],
- "homepage": "https://github.com/flesler/jquery.scrollTo",
- "support": {
- "issues": "https://github.com/flesler/jquery.scrollTo/issues",
- "source": "https://github.com/flesler/jquery.scrollTo"
- },
- "authors": [
- {
- "name": "Ariel Flesler",
- "web": "http://flesler.blogspot.com/"
- }
- ],
- "require": {
- "components/jquery": ">=1.8"
- },
- "extra": {
- "component": {
- "scripts": [
- "jquery.scrollTo.js"
- ],
- "files": [
- "jquery.scrollTo.min.js"
- ]
- }
- }
+{
+ "name": "flesler/jquery.scrollto",
+ "description": "Easy element scrolling using jQuery.",
+ "keywords": [
+ "browser", "animated", "animation",
+ "scrolling", "scroll", "links", "anchors"
+ ],
+ "homepage": "https://github.com/flesler/jquery.scrollTo",
+ "support": {
+ "issues": "https://github.com/flesler/jquery.scrollTo/issues",
+ "source": "https://github.com/flesler/jquery.scrollTo"
+ },
+ "authors": [
+ {
+ "name": "Ariel Flesler",
+ "web": "http://flesler.blogspot.com/"
+ }
+ ],
+ "require": {
+ "components/jquery": ">=1.4"
+ },
+ "extra": {
+ "component": {
+ "scripts": [
+ "jquery.scrollTo.js"
+ ],
+ "files": [
+ "jquery.scrollTo.min.js"
+ ]
+ }
+ }
}
View
@@ -5,7 +5,7 @@
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* @projectDescription Easy element scrolling using jQuery.
* @author Ariel Flesler
- * @version 1.4.13
+ * @version 1.4.14
*/
;(function (define) {
'use strict';
@@ -18,7 +18,7 @@
$scrollTo.defaults = {
axis:'xy',
- duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1,
+ duration: 0,
limit:true
};
@@ -171,7 +171,7 @@
};
function both( val ) {
- return $.isFunction(val) || typeof val == 'object' ? val : { top:val, left:val };
+ return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
}
// AMD requirement
@@ -2,6 +2,6 @@
* Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
* Licensed under MIT
* @author Ariel Flesler
- * @version 1.4.13
+ * @version 1.4.14
*/
-;(function(k){'use strict';k(['jquery'],function($){var j=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};j.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:!0};j.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(f,g,h){if(typeof g=='object'){h=g;g=0}if(typeof h=='function')h={onAfter:h};if(f=='max')f=9e9;h=$.extend({},j.defaults,h);g=g||h.duration;h.queue=h.queue&&h.axis.length>1;if(h.queue)g/=2;h.offset=both(h.offset);h.over=both(h.over);return this._scrollable().each(function(){if(f==null)return;var d=this,$elem=$(d),targ=f,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}var e=$.isFunction(h.offset)&&h.offset(d,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=j.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=e[pos]||0;if(h.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*h.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&h.queue){if(old!=attr[key])animate(h.onAfterFirst);delete attr[key]}});animate(h.onAfter);function animate(a){$elem.animate(attr,g,h.easing,a&&function(){a.call(this,targ,h)})}}).end()};j.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||typeof a=='object'?a:{top:a,left:a}}return j})}(typeof define==='function'&&define.amd?define:function(a,b){if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}}));
+;(function(k){'use strict';k(['jquery'],function($){var j=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};j.defaults={axis:'xy',duration:0,limit:!0};j.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(f,g,h){if(typeof g=='object'){h=g;g=0}if(typeof h=='function')h={onAfter:h};if(f=='max')f=9e9;h=$.extend({},j.defaults,h);g=g||h.duration;h.queue=h.queue&&h.axis.length>1;if(h.queue)g/=2;h.offset=both(h.offset);h.over=both(h.over);return this._scrollable().each(function(){if(f==null)return;var d=this,$elem=$(d),targ=f,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}var e=$.isFunction(h.offset)&&h.offset(d,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=j.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=e[pos]||0;if(h.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*h.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&h.queue){if(old!=attr[key])animate(h.onAfterFirst);delete attr[key]}});animate(h.onAfter);function animate(a){$elem.animate(attr,g,h.easing,a&&function(){a.call(this,targ,h)})}}).end()};j.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}return j})}(typeof define==='function'&&define.amd?define:function(a,b){if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}}));
View
@@ -1,11 +1,11 @@
{
"name": "jquery.scrollto",
- "version": "1.4.13",
+ "version": "1.4.14",
"description": "Easy element scrolling using jQuery.",
"main": "jquery.scrollTo.js",
"license": "MIT",
"ignore": ["**/.*","demo","tests","changes.txt","composer.json","scrollTo.jquery.json"],
- "dependencies": { "jquery": ">=1.8" },
+ "dependencies": { "jquery": ">=1.4" },
"homepage": "https://github.com/flesler/jquery.scrollTo/",
"bugs": "https://github.com/flesler/jquery.scrollTo/issues",
"repository": "git://github.com/flesler/jquery.scrollTo",
@@ -3,7 +3,7 @@
"title": "Ariel Flesler's jQuery scrollTo",
"description": "Easy element scrolling using jQuery.",
"keywords": ["browser", "animated", "animation", "scrolling", "scroll", "links", "anchors"],
- "version": "1.4.13",
+ "version": "1.4.14",
"author": {
"name": "Ariel Flesler",
"email": "[email protected]",
@@ -24,6 +24,6 @@
"download": "https://github.com/flesler/jquery.scrollTo/releases",
"demo": "http://demos.flesler.com/jquery/scrollTo",
"dependencies": {
- "jquery": ">=1.8"
+ "jquery": ">=1.4"
}
}

0 comments on commit 025405d

Please sign in to comment.