fadein - Jquery .html, then .fadeout -
i trying update .html('')
, delay(400)
, fadeout
, thereafter update .html('')
, , fadein
again...
if(data==1) { var html = "an other text" $('#nyhedsbrev').html('<br/><p style=\"width:100%; text-align:center;\">tak din tilmelding</p><br/>'); $('#nyhedsbrev').delay(2000).fadeout().html(html).fadein(); }
it works fine if use line 2 - or if try line one. however, these won't work.
i have tried combine 2 lines - deleting second $('#nyhedsbrev)
. can explain how can first show new text - fade out replace innner html , fade in?
- clarify - - - problem first part not show - fade out/in works...
jquery fadein / fadeout (and other animates methods) can take callback second argument.
if(data==1) { var newhtml = html; $('#nyhedsbrev').fadeout(500, function() { $('#nyhedsbrev').html(newhtml).fadein(); }); }
working example : jsfiddle
Comments
Post a Comment