如何在用户按下按钮“SEE MORE”后使用jquery滑动我的div?水平滑动(从左到右)
这是我的代码。但它不工作:(
code here <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var boxWidth = $("#leftpart").width();
$("#press button").click(function(){
$(this).next().animate({
width: 'toggle'
});
});
});
<div id="another" style="padding: 120px;">
<div class="container">
<div class="row">
<!-- right -->
<div class="col-lg-6 col-md-6">
<center><button type="button" class="seemore" id="press">See More</button></center>
<div id="leftpart" style="height: 540px; margin-right: 50px; background: yellow; display: none; position: relative;">
<p>HELLOOOOOOO</p>
</div>
</div>
</div>
</div>
</div>
试试这个代码https://api.jqueryui.com/slide-effect/。 也可以在代码中只写“$(”#按“”)“而不是”$(“#按按钮”)“。 – Archana