本文主要教大家如何简单实现jquery手风琴效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。
js代码:
<script type="text/javascript" src="jquery-3.0.0.js"></script> <script type="text/javascript"> $(function() { //获取所有li遍历 $(".li_list").each(function() { //当鼠标进去当前li $(this).mouseenter(function() { //设置当前元素宽度 $(this).stop() .animate({ "width": "600px" }, 500, "linear"); //设置同胞元素宽度 .siblings().stop() .animate({ "width": "100px" }, 500, "linear"); }); }); }); </script>
css代码:
.li_list { width: 100px; height: 300px; list-style: none; float: left; overflow: hidden; } .li_list img { width: 100%; height: 100%; } .pbg { width: 600px; height: 300px; background: rgba(230, 0, 0, 0.5); text-align: center; line-height: 300px; float: left; } .pbg span { display: block; width: 100px; height: 300px; float: left; } .p1 { width: 500px; height: 300px; float: left; } .mo{ width: 600px; }
html代码:
<ul class="ul_list"> <li class="li_list"> <p class="pbg"> <span>萌宠</span> <p class="p1"> @@##@@ </p> </p> </li> <li class="li_list"> <p class="pbg"> <span>萌宠</span> <p class="p1"> @@##@@ </p> </p> </li> <li class="li_list"> <p class="pbg"> <span>萌宠</span> <p class="p1"> @@##@@ </p> </p> </li> <li class="li_list mo"> <p class="pbg"> <span>萌宠</span> <p class="p1"> @@##@@ </p> </p> </li> </ul>
相关推荐:
以上就是简单实现jQuery手风琴效果方法分享的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号