我正在显示和隐藏包含文本的div,以便能够看到背后的背景图像。我被扶上很让我的div只是动了一下,并让我的DIV可见一侧有没有办法显示/隐藏在显示和隐藏同一个div的图像切换
$("#welcome").toggle(
function() {
var left = $(this).outerWidth() - 10 + "px";
$(this).animate({ "margin-left": "+=" + left }, 500);
$(this).onClick() },
function() {
var left = $(this).outerWidth() - 10 + "px";
$(this).animate({ "margin-left": "-=" + left }, 500);
}
);
现在我想我的HTML图像改变形式隐藏显示...
<div id="welcomepicture">
<div id="welcome">
Welcome some really meaningful text here!
<p class="arrowfull"><a href="#"> <img class="img-swap" src="http://housing.ucsc.edu/guide/css/images/hide_off.png" alt="Click to view full image" title="Click to view full image" height="42" width="17"> </a></p>
我不确定是否在JavaScript中,如果我把.onClick图像交换?或者我写一个新的变种? 新来的jQuery和JavaScript,感谢您的帮助
http://jsfiddle.net/BeccaAlley/UfsS8/4/
我认为我做错了没有.attr在我的代码中,谢谢佩德罗的帮助。 –
没问题。快乐的编码! –