jQuery的切换的按钮两个图像? [英] jquery toggle with buttons two images?
本文介绍了jQuery的切换的按钮两个图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要切换隐藏/显示,我用这个code;
To toggle hide/show, i used this code;
togglebtn.click(function() {
var that = this;
$('.togglecontainer').toggle(500, function(){
var txt = $(that).html();
$(that).html((txt == 'Show less') ? 'Show more' : 'Show less');
});
});
togglebtn.trigger("click");
但它切换一个按钮内的文本。我想两个按钮,有两个不同势IMG SRC的
比方说,图像/ show.png和图像/ hide.png
But it toggles text inside one button. I want two buttons, with two diffrent img src's let's say images/show.png and images/hide.png
在此先感谢
推荐答案
有一个在这个教程 - 的 jQuery的图片互换使用点击 - 这可能是你想达到什么目的。让我们知道您的身体情况如何。
Have a look at this Tutorial - jQuery Image Swap Using Click - This may be what you are trying to achieve. Let us know how you get on.
这篇关于jQuery的切换的按钮两个图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文