我有以下代码。点击后我想更改暂停滑块并更改图像暂停。此代码暂停幻灯片放映但不重新启动。它也不会切换图像。
$(document).ready(function () {
$("#nextbackcontrols").show();
$('.slideshow').cycle({
fx: 'fade',
prev: '#prev',
next: '#next'
});
$('#play').click(function () {
$('.slideshow').cycle('toggle');
$("#play img").toggle(
function () {
$(this).find("img").attr({ src: "/common/images/play.gif" });
},
function () {
$(this).find("img").attr({ src: "/common/images/pause.gif" });
}
);
});
});
答案 0 :(得分:1)
试试这个:
$('#play').live("click", function () {
$('.slideshow').cycle('toggle');
$("#play img").toggle(
function () {
// previously you were `.find`ing an image within an image
$(this).attr({ src: "/common/images/play.gif" });
},
function () {
$(this).attr({ src: "/common/images/pause.gif" });
}
);
});