简体   繁体   中英

the slide animation of jquery doesn't work properly

i would to slide a div from left to right side when clicked on a button. i use the following code:

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<body>
    <button type="button" onClick="f1()">click</button>
    <div id="p1" style="display:none">
        content
    </div>
</body>
<script type="text/javascript">
    function f1(){
        $('#p1').show("slide", { direction: "left" }, 5000);
    }
</script>

but the transition doesn't occurs and the slide animation doesn't show. the "p1" div immediately shows after the button clicked. how can i solve this?

This effect doesn't come with the basic jquery Package. You have to enque the jQuery UI library also. jQuery UI

See this documentation for further slide effects Slide effect

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM