i have implemented a jquery for fix header when user scrolls down the header will get fix position. But it is working in all browser except ie8. could anyone suggest the correct way.
$(document).ready(function()
{
$(document).scroll(function()
{
var window_y = $(window).scrollTop();
var header_h = $('.header').height();
if(window_y > header_h)
{
$(".header").addClass('fixed');
}
else
{
$(".header").removeClass('fixed');
}
});
});
Working reference is here.