Created
June 29, 2011 09:55
-
-
Save kebot/1053554 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.letsFixed = function(options){ | |
// make default settings | |
var settings = {} | |
return this.each( | |
function(){ | |
// let them fixed | |
var t=$(this); | |
var width=t.css('width'); | |
var height = t.css('height'); | |
var offset = t.offset(); | |
var n = t.clone().empty().html(' ').css({width:width,height:height}); | |
t.after(n); | |
t.css({position:'fixed',top:offset.top,left:offset.left,'z-index':100}); | |
// fix for IE6 | |
if($.browser.msie&&($.browser.version == "6.0")&&!$.support.style){ | |
t.css('position', 'absolute'); | |
$(document).scroll(function(){ | |
t.css('top', $(document).scrollTop() + offset.top); | |
}); | |
//t.css({'_position':'absolute','_top':'expression(eval(document.documentElement.scrollTop+'+offset.top+'))'}); | |
} | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment