html5 - Problem with Jquery toggle / animate -



html5 - Problem with Jquery toggle / animate -

my website: http://www.daysofthedead.net

i have made 2 sliding panels on right side of screen. 1 facebook, other twitter. click facebook tab , opens, if click twitter tab while facebook panel still open facebook close , twitter open, , vice-versa.

my problem: click 1 time open facebook open twitter. after have click each tab twice unless close panel before open sec panel.

can take @ code below , help me figure out why this?

take @ code here: http://jsfiddle.net/draven/4bqas/

i think toggle creating problems, in case can utilize click:

$('.panel-tab').click(function(event) { var = this; if ($('.active').length > 0) { $('.active').animate({ marginright: '0' }, 1000,'linear', function() { var targetclosed = $(this).find('a').data('target'); var targetopen = $(that).data('target'); if (targetclosed != targetopen){ $('#panel-' + targetopen).animate({ marginright: '292' }, 1000).addclass('active'); } }).removeclass('active'); } else { $('#panel-' + $(this).data('target')).animate({ marginright: '292' }, 1000).addclass('active'); } });

fidlle here: http://jsfiddle.net/4bqas/8/

jquery html5 css3

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -