大佬教程收集整理的这篇文章主要介绍了javascript – 使用jquery单击后更改另一个图像,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个图像作为切换动画(button.png)的按钮,我希望该图像在单击它以获得另一个图像(button2.png)后更改,并且一旦您单击第二个图像,它将再次更改为第一张图片,我有:
<script type="text/javascript"> $(document).ready(function() { // when click on the tag with id="btn" $('#btn').click(function() { // change the state of the "#idd" $('#idd').toggle(800,function() { // change the button text according to the state of the "#idd" if ($('#idd').is(':visible')) { $('#btn').attr('images/button2.png',this.href); // Show Less.. button } else { $('#btn').attr('images/button.png',this.href); //Learn More.. button } }); }); }); </script>
和我的Html:
<div id="idd" style="display:none;"> - Here my hidden content - </div> <!-- Button --> <img src="images/button.png" style="cursor: pointer;" id="btn">
我做错了什么?请帮忙 :(
以上是大佬教程为你收集整理的javascript – 使用jquery单击后更改另一个图像全部内容,希望文章能够帮你解决javascript – 使用jquery单击后更改另一个图像所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。