Scroll a div with Jquery -


i have click function slides contact form down top of page , pushes rest of page down. have absolute position div stays , need scroll down if didn't have absolute position.

$("#contact-tab").toggle(function() {     $('#contact-form-wrapper').slidetoggle();         // scroll #absolute div vertically height of #contact-form-wrapper     }, function() {         $('#contact-form-wrapper').slidetoggle();         // scroll #absolute     });  #absolute {     position: absolute;     top: 500px; } #contact-form-wrapper {     width:100%;     height:370px;     top:0; } 

example: http://jsfiddle.net/benners/fv2sp/

consider change position method, anyway using progress callback can solve problem should use version 1.8+ of jquery.

$(document).ready(function() {     $('#contact-form').hide();      $("#contact-us").toggle(function() {         $('#contact-form').slidetoggle({             progress:function(anime,progr,remain){                 $("#absolute").css('top',( $(this).height() + 150));             }         });     }, function() {         $('#contact-form').slidetoggle({             progress:function(anime,progr,remain){                 $("#absolute").css('top',( $(this).height() + 150));             }         });     });  }); 

see updated jsfiddle.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -