javascript - jQuery - Using .slideToggle and .animate simultaneously -


i have portion of jquery doesn't seem working correctly. have link click, [show/hide] should slidetoggle div. @ same time, want animate page scrolls top of div. works when put animate function inside slidetoggle function, in jfiddle.

however, means div want slides out, , then page scrolls down. id set both happen simultatneously, tried in this jfiddle doesn't work. tried doing scroll animation first, slidetoggle, didn't work - there way implement also?? cheers!

$(document).ready(function () {     $('.click_to_hide').click(function () {         var visible = $('.hide_on_click').is(":visible");         $('.hide_on_click').slidetoggle(500);         if (!visible) {             $('html, body').animate({                 scrolltop: $('.hide_on_click').offset().top             }, 500);         }     }); }); 

http://fiddle.jshell.net/yfr2e/3/


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -