Skip to content

Instantly share code, notes, and snippets.

@kebot
Created June 29, 2011 09:55
Show Gist options
  • Save kebot/1053554 to your computer and use it in GitHub Desktop.
Save kebot/1053554 to your computer and use it in GitHub Desktop.
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