Saturday, 15 June 2013

javascript - On click fade out div then fade back in -


I have implemented a toggle idea page, where you can toggle between the toggle states between the animation list and the grid. Ugly (toggle using the two links at the top of the meaning I see):

To solve this problem I want to apply a setTimeout function to the toggle button I am trying to first, I can fade the parent div #lotest list To make changes and layout and then # post-list fade back. When I expel it, but there is no change in layout:

Can anyone find out why this is happening? Here is snippet of JS:

  function init () {optionSwitch.forEach (function (L, I) {el.addEventListener ('click', function ) {$ ('# -list-list') AddClass ('go'); // setteimeout fadeout (function () {_switch (this); // update layout; switch refers to another function}, 500 ); SetTimeout (function () {$ ('# post-list') .removeClass ('go'); // federate back to the new layout}, 1000);}, false);}); }  

You are using jquery, you are not actually using jquery Jquery comes with a fadeIn and fadeOut animation that you can use.

  var $ pl = $ ('# -post-list'); $ Pl.fadeOut ('slower', function) (// When the animation is done back / call here / you can apply the layout change pl.fadeIn $ ('slow', function) (// call back when fade Animation is done / / do other stuff here});});  

is a basic example.

You should also change your code in jquery equivalent.

Let me know that this is what you were looking for.


No comments:

Post a Comment