Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Help with unbind then bind again after animation sequence

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34181
    boxadesign
    Member

    Hey all,

    I have the following js function and I would like to prevent anything from happening and queueing once the click event has happened. Then when the function ends allow the click event to happen again.

    $(“#tweet_activate a”).click(function(){
    if($(‘body’).hasClass(‘home’)) {
    $(this).parent().stop(true,true).animate({top: “+=154”}, 400).delay(1200).fadeOut();
    } else {
    $(“#int_comp”).animate({width: “+=157”}, 100);
    $(this).parent().stop(true,true).animate({top: “+=154”}, 400).delay(1200).fadeOut();
    }
    $(“#tweet_text”).delay(400).animate({right: “+=56”}, 400);
    $(“#tweet”).delay(900).animate({right: “+=214”}, 400);
    $(“#tweet_deactivate”).delay(1200).fadeIn();
    $(“#tweet_text p, #tweet_text span, #tweet #links”).delay(1200).fadeIn();
    $(“#eye”).delay(600).fadeOut();
    return false;
    });

    $(“#tweet_deactivate a”).click(function(){
    if($(‘body’).hasClass(‘home’)) {
    } else {
    $(“#int_comp”).animate({width: “-=157”}, 400);
    }
    $(“#tweet_text p, #tweet_text span, #tweet #links”).fadeOut();
    $(“#tweet”).stop(true,true).animate({right: “-=214”}, 400);
    $(“#tweet_text”).delay(400).animate({right: “-=56”}, 400);
    $(this).parent().delay(900).animate({top: “-=154”}, 400).delay(200).fadeOut()
    .delay(600).animate({top: “+=154”}, 100);
    $(“#tweet_activate”).animate({top: “-=154”}, 500).delay(650).fadeIn();
    $(“#eye”).delay(1000).fadeIn();
    return false;
    });

    The site is here – http://danielhollandphotography.com/

    If you click on the ‘plus’ sign on the right icon grid you’ll see the sequence happen. If you click the icon mid way through you’ll see it fire again.

    Thanks, Matt

    #86139
    boxadesign
    Member

    Fixed with this code for those interested….

    var animating = false;
    $(“#tweet_activate a”).click(function() {
    if (animating !== true) {
    animating = true;
    if ($(‘body’).hasClass(‘home’)) {
    $(this).parent().stop(true, true).animate({
    top: “+=154”
    }, 400).delay(1200).fadeOut();
    } else {
    $(“#int_comp”).animate({
    width: “+=157”
    }, 100);
    $(this).parent().stop(true, true).animate({
    top: “+=154”
    }, 400).delay(1200).fadeOut();
    }
    $(“#tweet_text”).delay(400).animate({
    right: “+=56”
    }, 400);
    $(“#tweet”).delay(900).animate({
    right: “+=214”
    }, 400);
    $(“#tweet_deactivate”).delay(1200).fadeIn();
    $(“#tweet_text p, #tweet_text span, #tweet #links”).delay(1200).fadeIn();
    $(“#eye”).delay(600).fadeOut(function() {
    animating = false;
    });
    }
    return false;
    });
    $(“#tweet_deactivate a”).click(function(){
    if (animating !== true) {
    animating = true;
    if($(‘body’).hasClass(‘home’)) {
    } else {
    $(“#int_comp”).animate({
    width: “-=157”
    }, 400);
    }
    $(“#tweet_text p, #tweet_text span, #tweet #links”).fadeOut();
    $(“#tweet”).stop(true,true).animate({
    right: “-=214”
    }, 400);
    $(“#tweet_text”).delay(400).animate({
    right: “-=56”
    }, 400);
    $(this).parent().delay(900).animate({
    top: “-=154”
    }, 400).delay(200).fadeOut()
    .delay(600).animate({
    top: “+=154”
    }, 100);
    $(“#tweet_activate”).animate({
    top: “-=154”
    }, 500).delay(650).fadeIn();
    $(“#eye”).delay(1000).fadeIn(function() {
    animating = false;
    });
    }
    return false;
    });

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.