开发者

SlideUp by jQuery

开发者 https://www.devze.com 2023-04-05 08:32 出处:网络
I\'m trying to slideUp part of page by jQuery. I use this code $(\"#FirstPage\").slideUp(1000); I will hide FirstPage part of page,but not by time,I mean that it will hide suddenly not by 1000 ms.

I'm trying to slideUp part of page by jQuery. I use this code

$("#FirstPage").slideUp(1000);

I will hide FirstPage part of page,but not by time,I mean that it will hide suddenly not by 1000 ms.

the following code is FirstPage part,which should be hide after 1000ms and with slideUp.

<div id="FirstPage">
    <div id="Login">
        <form method="post" id="LoginForm">
        <br />
        <input开发者_如何学Python type="text" name="username" id="username" />
        <br />
        <input type="password" name="passowrd" id="password" />
        <br />
        <input type="checkbox" name="invisible" value="TRUE" id="invisible" />
        <br />
        <img src="" /><input type="text" name="captcha" disabled="true" style="display: none"
            id="captcha" />
        <br />
        <input type="button" value="Login ..." onclick="Ajax_Login()" />
        </form>
    </div>
    <div class="OtherFeaturBig" id="WindowsVersion">
        <img src="http://localhost/Files/Images/02.jpg" />
    </div>
    <div class="OtherFeaturBig" id="Advertisment">
        <img src="http://localhost/Files/Images/02.jpg" />
    </div>
    <div class="OtherFeaturSmall" id="AboutUs">
        <img src="http://localhost/Files/Images/03.jpg" />
    </div>
    <div class="OtherFeaturSmall" id="ContactUs">
        <img src="http://localhost/Files/Images/03.jpg" />
    </div>
</div>

where is my code problem?


This code works fine to slide your div up upon the click of a button:

$("#hide").click(function() {
    $("#FirstPage").slideUp(1000);
})

As used in this jsFiddle with your HTML (I removed the non-functioning images): http://jsfiddle.net/jfriend00/JFRGr/.

So, the issue must have to do with either your code or the rest of your HTML, both of which you have not shared. If you want further help, please show us the actual code you are using and explain what triggers the code to run.

As Trikks said, make sure that you aren't calling slideUp before the page is fully loaded.


try

Ensure to run your code after document.ready so the DOM is really loaded. Also ensure that jQuery is loaded and 1sec = 1000 ms...

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $("#FirstPage").slideUp(1000);
    });
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消