user1945034
user1945034

Reputation: 65

Scroll a Div when Scroll the page

This function jquery, scroll a div (with the css named "Search") when the user scroll the page..

$(window).scroll(function(){
     $.each($('.Search'),function(){
         var windowpos = $(window).scrollTop();
         var finaldestination = windowpos+90; 
         $(this).stop().animate({'top':finaldestination},300);
     });
});

This function jquery doesn't work in Internet Explorer 9. I tried to do a css that contain the attribute position:fixed but this doesn't work in Internet Explorer 9. There is a solution that allows me to scroll a div when the user scrolls the page in Internet Explorer? I apologize for the basic English

Upvotes: 2

Views: 185

Answers (2)

MG_Bautista
MG_Bautista

Reputation: 2663

You can use only css...

.search {
  width: 200px;
  height: 50px;
  background-color: red;
  position: fixed;
  top: 90px;
}

See the Example

Greetings.

Upvotes: 2

Seain Malkin
Seain Malkin

Reputation: 2303

Works fine in IE. The CSS I used for search is

.search {
  position: absolute;
  top: 90px;
}

Working Demo

Edit

For a faster animation transition, clear the queue.

.stop(true)

Upvotes: 0

Related Questions