admin管理员组

文章数量:1333442

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(thisplete)
            $(this).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.plete)
            $(this).load();
    });
});
Share Improve this question edited May 17, 2013 at 19:09 Sam 4,5952 gold badges30 silver badges31 bronze badges asked May 17, 2013 at 18:55 theCodertheCoder 711 gold badge1 silver badge5 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You can try this -

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

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

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/tymeJV/VBtUU/

本文标签: javascriptJquery Image Slide Up After Page LoadStack Overflow