Вариант 1:
$(function () {
if ($(/*"ul.empty_legs_full_list_head"*/ul:first).offset(top:val.top/*0*/))
{
$(".empty_legs_full_list_head")/*.append*//*.css*/.attr('position', 'fixed');,
}
if($("ul:last").offset({top:0}))
{
$(".empty_legs_full_list_head").remove("position", "fixed").append("position", "static");
}
Вариант 2:
function moveScroll() {
var scroll = $(window).scrollTop();
var table_top = $("#empty_legs_full_list_head").offset().top;
clone_table = $("#clone");
if (clone_table.length == 0) {
clone_table = $("#empty_legs_full_list_head").clone();
clone_table.attr('id', 'clone');
clone_table.css({
position: 'fixed',
'pointer-events': 'none',
top: 0
});
clone_table.width($("empty_legs_full_list_head").width() + vborder);
$("#empty_legs_full_list_head").append(clone_table);
$("#clone").css({
visibility: 'visible'
});
$("#clone empty_legs_full_list").css({
visibility: 'hidden'
});
}
} else {
$("#clone").remove();
}
}
$(window).scroll(moveScroll);