Forums

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

Home Forums JavaScript [Solved] A .click() function to add a CSS attribute, but using a delay first

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30251
    noahgelman
    Participant

    I want to use a .click() function to give an image a certain width. Easy peasy, but I want to add a small timed delay first, how could I accomplish that? The .delay() function isn’t able to work with delaying a .css() or .width() function.

    #79709
    jamygolden
    Member
    function backgroundRed(){
    $("body").css("background", "red");
    }
    function delayFunc(){
    setTimeout("backgroundRed()", 2000);
    }

    $(document).ready(function(){
    $("a").click(function(){
    delayFunc();
    });
    });
    #79702
    noahgelman
    Participant

    Thank you. That really helped a lot.

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