Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

See #14: Detect any iOS 5 version.

  • Loading branch information...
commit b7cd3282b42d475b28a7d7c35a84ee37608356cb 1 parent cfbd3b5
@bigspotteddog authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  jquery-scrolltofixed-min.js
  2. +1 −1  jquery-scrolltofixed.js
View
2  jquery-scrolltofixed-min.js
@@ -1 +1 @@
-(function(a){a.ScrollToFixed=function(c,f){var i=this;i.$el=a(c);i.el=c;i.$el.data("ScrollToFixed",i);var b=false;var w=i.$el;var u=0;var l=0;var g=-1;var d=-1;var n=null;function o(){h();d=-1;u=w.offset().top;l=w.offset().left;if(g==-1){orginalOffsetLeft=l}b=true;if(i.options.bottom!=-1){q()}}function k(){return w.css("position")=="fixed"}function r(){return w.css("position")=="absolute"}function e(){return !(k()||r())}function q(){if(!k()){n.css({display:w.css("display"),width:w.outerWidth(true),height:w.outerHeight(true),"float":w.css("float")});w.css({width:w.width(),position:"fixed",top:i.options.bottom==-1?m():"",bottom:i.options.bottom==-1?"":i.options.bottom})}}function h(){if(!e()){d=-1;n.css("display","none");w.css({width:"",position:"",left:"",top:""})}}function p(y){if(y!=d){w.css("left",l-y);d=y}}function m(){return i.options.marginTop}function s(){if(!b){o()}var z=a(window).scrollLeft();var A=a(window).scrollTop();if(i.options.bottom==-1){if(i.options.limit>0&&A>=i.options.limit-m()){if(!r()){j();w.trigger("preAbsolute");w.css({width:w.width(),position:"absolute",top:i.options.limit,left:l});w.trigger("unfixed")}}else{if(A>=u-m()){if(!k()){j();w.trigger("preFixed");q();d=-1;w.trigger("fixed")}p(z)}else{if(k()){j();w.trigger("preUnfixed");h();w.trigger("unfixed")}}}}else{if(i.options.limit>0){if(A+a(window).height()-w.outerHeight(true)>=i.options.limit-m()){if(k()){j();w.trigger("preUnfixed");h();w.trigger("unfixed")}}else{if(!k()){j();w.trigger("preFixed");q()}p(z);w.trigger("fixed")}}else{p(z)}}}function j(){var x=w.css("position");if(x=="absolute"){w.trigger("postAbsolute")}else{if(x=="fixed"){w.trigger("postFixed")}else{w.trigger("postUnfixed")}}}var t=function(x){o();s()};var v=function(x){s()};i.init=function(){i.options=a.extend({},a.ScrollToFixed.defaultOptions,f);if(navigator.platform==="iPad"||navigator.platform==="iPhone"||navigator.platform==="iPod"){if(!navigator.userAgent.match(/OS 5_\d like Mac OS X/i)){return}}i.$el.css("z-index",i.options.zIndex);n=a("<div/>");i.$el.after(n);a(window).bind("resize.ScrollToFixed",t);a(window).bind("scroll.ScrollToFixed",v);if(i.options.preFixed){w.bind("preFixed.ScrollToFixed",i.options.preFixed)}if(i.options.postFixed){w.bind("postFixed.ScrollToFixed",i.options.postFixed)}if(i.options.preUnfixed){w.bind("preUnfixed.ScrollToFixed",i.options.preUnfixed)}if(i.options.postUnfixed){w.bind("postUnfixed.ScrollToFixed",i.options.postUnfixed)}if(i.options.preAbsolute){w.bind("preAbsolute.ScrollToFixed",i.options.preAbsolute)}if(i.options.postAbsolute){w.bind("postAbsolute.ScrollToFixed",i.options.postAbsolute)}if(i.options.fixed){w.bind("fixed.ScrollToFixed",i.options.fixed)}if(i.options.unfixed){w.bind("unfixed.ScrollToFixed",i.options.unfixed)}w.bind("remove.ScrollToFixed",function(){h();a(window).unbind("resize",t);a(window).unbind("scroll",v);w.unbind(".ScrollToFixed")});if(i.options.bottom!=-1){if(!k()){j();w.trigger("preFixed.ScrollToFixed");q()}}};i.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery);
+(function(a){a.ScrollToFixed=function(c,f){var i=this;i.$el=a(c);i.el=c;i.$el.data("ScrollToFixed",i);var b=false;var w=i.$el;var u=0;var l=0;var g=-1;var d=-1;var n=null;function o(){h();d=-1;u=w.offset().top;l=w.offset().left;if(g==-1){orginalOffsetLeft=l}b=true;if(i.options.bottom!=-1){q()}}function k(){return w.css("position")=="fixed"}function r(){return w.css("position")=="absolute"}function e(){return !(k()||r())}function q(){if(!k()){n.css({display:w.css("display"),width:w.outerWidth(true),height:w.outerHeight(true),"float":w.css("float")});w.css({width:w.width(),position:"fixed",top:i.options.bottom==-1?m():"",bottom:i.options.bottom==-1?"":i.options.bottom})}}function h(){if(!e()){d=-1;n.css("display","none");w.css({width:"",position:"",left:"",top:""})}}function p(y){if(y!=d){w.css("left",l-y);d=y}}function m(){return i.options.marginTop}function s(){if(!b){o()}var z=a(window).scrollLeft();var A=a(window).scrollTop();if(i.options.bottom==-1){if(i.options.limit>0&&A>=i.options.limit-m()){if(!r()){j();w.trigger("preAbsolute");w.css({width:w.width(),position:"absolute",top:i.options.limit,left:l});w.trigger("unfixed")}}else{if(A>=u-m()){if(!k()){j();w.trigger("preFixed");q();d=-1;w.trigger("fixed")}p(z)}else{if(k()){j();w.trigger("preUnfixed");h();w.trigger("unfixed")}}}}else{if(i.options.limit>0){if(A+a(window).height()-w.outerHeight(true)>=i.options.limit-m()){if(k()){j();w.trigger("preUnfixed");h();w.trigger("unfixed")}}else{if(!k()){j();w.trigger("preFixed");q()}p(z);w.trigger("fixed")}}else{p(z)}}}function j(){var x=w.css("position");if(x=="absolute"){w.trigger("postAbsolute")}else{if(x=="fixed"){w.trigger("postFixed")}else{w.trigger("postUnfixed")}}}var t=function(x){o();s()};var v=function(x){s()};i.init=function(){i.options=a.extend({},a.ScrollToFixed.defaultOptions,f);if(navigator.platform==="iPad"||navigator.platform==="iPhone"||navigator.platform==="iPod"){if(!navigator.userAgent.match(/OS 5_.*\ like Mac OS X/i)){return}}i.$el.css("z-index",i.options.zIndex);n=a("<div/>");i.$el.after(n);a(window).bind("resize.ScrollToFixed",t);a(window).bind("scroll.ScrollToFixed",v);if(i.options.preFixed){w.bind("preFixed.ScrollToFixed",i.options.preFixed)}if(i.options.postFixed){w.bind("postFixed.ScrollToFixed",i.options.postFixed)}if(i.options.preUnfixed){w.bind("preUnfixed.ScrollToFixed",i.options.preUnfixed)}if(i.options.postUnfixed){w.bind("postUnfixed.ScrollToFixed",i.options.postUnfixed)}if(i.options.preAbsolute){w.bind("preAbsolute.ScrollToFixed",i.options.preAbsolute)}if(i.options.postAbsolute){w.bind("postAbsolute.ScrollToFixed",i.options.postAbsolute)}if(i.options.fixed){w.bind("fixed.ScrollToFixed",i.options.fixed)}if(i.options.unfixed){w.bind("unfixed.ScrollToFixed",i.options.unfixed)}w.bind("remove.ScrollToFixed",function(){h();a(window).unbind("resize",t);a(window).unbind("scroll",v);w.unbind(".ScrollToFixed")});if(i.options.bottom!=-1){if(!k()){j();w.trigger("preFixed.ScrollToFixed");q()}}};i.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery);
View
2  jquery-scrolltofixed.js
@@ -279,7 +279,7 @@
// what to do with them, or until iOS5 comes out which is supposed
// to support position:fixed.
if (navigator.platform === 'iPad' || navigator.platform === 'iPhone' || navigator.platform === "iPod") {
- if (!navigator.userAgent.match(/OS 5_\d like Mac OS X/i)) {
+ if (!navigator.userAgent.match(/OS 5_.*\ like Mac OS X/i)) {
return;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.