javascript - jQuery Div Scrolling Function: Issue in IE -


i'm developing website that has fixed banner div centered, , i'm using jquery below ensure scrolls correctly though fixed positioned div.

jquery:

$(window).scroll(function() {      $('#top-content').css('left', -$(this).scrollleft() + "px");  }); 

however, have come across issue within ie(version 9). issue when user scrolls website (creating minus left margin on "top-content" div, give effect of scrolling) , if maximize webpage, left margin still present causing div not centered.

i have attempted remedy jquery below, of yet no luck

$(window).resize(function() {      if ($("#top-content").width() < $(window).width()) {          $('#top-content').css('left:0px');      }     }); 

any ideas?

you better do

$('#top-content').css('left', '0px'); 

in resize event.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -