theCoder
theCoder

Reputation: 71

Jquery Image Slide Up After Page Load

Pls I am working on a website. I want a situation on the home page where an image of a man standing will slide up 1 or 2 seconds after the whole page has loaded. I need someone to help me with a codepen example.

Below is the code I inserted in the head section. I set the image to display:none in css, but when I refresh, I found out it's not working. #man is the id of the image.

Thank u.

$(function() {
    $("#man").one('load', function () {
        $(this).show("slide", { direction: "up" }, 2000);
    }).each(function() { 
        if(this.complete)
            $(this).load();
    });
});

Upvotes: 0

Views: 10277

Answers (2)

Adil Shaikh
Adil Shaikh

Reputation: 44740

You can try this -

$(window).load(function(){
   $("#man").show("slide", {
      direction: "up"
   }, 2000);
});

Demo --> http://jsfiddle.net/CqR9E/2/

Upvotes: 5

tymeJV
tymeJV

Reputation: 104775

Not sure if you need all that...the below code will slide up after a 2000 ms delay:

slideTimer = setInterval(function() {
    $('#man').slideUp();
}, 2000);

Demo: http://jsfiddle.net/tymeJV/VBtUU/

Upvotes: 0

Related Questions