hello friends i designed a floating div and its working perfectly but due to some reasons i don’t want to use position:relative or position:absolute in my code
$(window).scroll(function () {
var topWindowPosition = $(window).scrollTop();
var leftWindowPosition = $(window).scrollLeft();
var topLeftNavHeight = 200;
if (topWindowPosition >= topLeftNavHeight) {
$("#scroll").css({ top: topWindowPosition - topLeftNavHeight, left: 0, position: 'relative' });
} else {
$("#scroll").css({ top: 0, left: 0, position: 'relative' });
}
$("#scroll").forceRedraw();
});
you can also see working demo here
can i make the same effect without using positions please help me out.
Thanks in advance
Sure, just use
marginsinstead ofpositions. Eg:jsFiddle: http://jsfiddle.net/9E225/2/