jQuery effects – sliding(), stop() animation

jQuery effects effects that can be added to parts of a web page using the jQuery library. These effects include jQuery effects – sliding(), stop() animation and more.

Slide Effects

    • sliding()
    • stop()
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- stop sliding -->
<!-- stop animation -->
<div style="width:300px;height:300px;background-color: slateblue;" class="box">
<div class="box2" style="width:30px;height:30px;background-color: red;position: absolute;"></div>
</div>
<div style="position: absolute; left: 30%;top:20%;">
<button class="btn1">stop sliding</button>
<button class="btn2">stop animation</button>
<button class="btn3">slide down</button>
<button class="btn4">slide up</button>
<button class="btn5">start animation</button>
</div>
<script src="jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
$(".btn3").click(function(){
$(".box").slideDown(5000)
})
$(".btn4").click(function(){
$(".box").slideUp(5000)
})
$(".btn1").click(function(){
$(".box").stop()
})
$(".btn2").click(function(){
$(".box2").stop()
})
$(".btn5").click(function(){
$(".box2").animate({"left":"40%",},5000)
$(".box2").animate({"top":"40%",},5000)
$(".box2").animate({"left":"0%",},5000)
$(".box2").animate({"top":"0%",},5000)
})
})
</script>
</body>
</html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <!-- stop sliding --> <!-- stop animation --> <div style="width:300px;height:300px;background-color: slateblue;" class="box"> <div class="box2" style="width:30px;height:30px;background-color: red;position: absolute;"></div> </div> <div style="position: absolute; left: 30%;top:20%;"> <button class="btn1">stop sliding</button> <button class="btn2">stop animation</button> <button class="btn3">slide down</button> <button class="btn4">slide up</button> <button class="btn5">start animation</button> </div> <script src="jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(".btn3").click(function(){ $(".box").slideDown(5000) }) $(".btn4").click(function(){ $(".box").slideUp(5000) }) $(".btn1").click(function(){ $(".box").stop() }) $(".btn2").click(function(){ $(".box2").stop() }) $(".btn5").click(function(){ $(".box2").animate({"left":"40%",},5000) $(".box2").animate({"top":"40%",},5000) $(".box2").animate({"left":"0%",},5000) $(".box2").animate({"top":"0%",},5000) }) }) </script> </body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- stop sliding -->
    <!-- stop animation -->

    <div style="width:300px;height:300px;background-color: slateblue;" class="box">
        <div class="box2" style="width:30px;height:30px;background-color: red;position: absolute;"></div>
    </div>
<div style="position: absolute; left: 30%;top:20%;">
    <button class="btn1">stop sliding</button>
    <button class="btn2">stop animation</button>
    <button class="btn3">slide down</button>
    <button class="btn4">slide up</button>
    <button class="btn5">start animation</button>
    
</div>

    <script src="jquery-3.6.0.min.js"></script>

    <script>
$(document).ready(function(){
$(".btn3").click(function(){
$(".box").slideDown(5000)
})

$(".btn4").click(function(){
$(".box").slideUp(5000)
})

$(".btn1").click(function(){
$(".box").stop()
})

$(".btn2").click(function(){
$(".box2").stop()
})

$(".btn5").click(function(){
$(".box2").animate({"left":"40%",},5000)
$(".box2").animate({"top":"40%",},5000)
$(".box2").animate({"left":"0%",},5000)
$(".box2").animate({"top":"0%",},5000)
})
        })
    </script>
    
</body>
</html>

Tags: sliding(), stop(),  jquery effects, jquery effects tutorials, jquery, jquery code snippets

MIT license