-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathjquery.autofix_anything.min.js
1 lines (1 loc) · 1.03 KB
/
jquery.autofix_anything.min.js
1
!function(e){var t={customOffset:false,manual:false,onlyInContainer:true};e.fn.autofix_anything=function(n){var r=e.extend({},t,n),i=e(this),s=i.position(),o=r.customOffset,u=i.offset();i.addClass("autofix_sb");e.fn.manualfix=function(){var t=e(this),n=t.offset();if(t.hasClass("fixed")){t.removeClass("fixed")}else{t.addClass("fixed").css({top:0,left:n.left,right:"auto",bottom:"auto"})}};fixAll=function(t,n,r,i){if(n.customOffset==false)o=t.parent().offset().top;if(e(document).scrollTop()>o&&e(document).scrollTop()<=t.parent().height()+(o-e(window).height())){t.removeClass("bottom").addClass("fixed").css({top:0,left:i.left,right:"auto",bottom:"auto"})}else{if(e(document).scrollTop()>o){if(n.onlyInContainer==true){if(e(document).scrollTop()>t.parent().height()-e(window).height()){t.addClass("bottom fixed").removeAttr("style").css({left:r.left})}else{t.removeClass("bottom fixed").removeAttr("style")}}}else{t.removeClass("bottom fixed").removeAttr("style")}}};if(r.manual==false){e(window).scroll(function(){fixAll(i,r,s,u)})}}}(window.jQuery)