var $nav = $('.nav');
var $img = $('img');
$nav.on('click', function() {
//determine new position
currentPosition = ($(this).attr('id')=='rightNav')
? currentPosition+1 : currentPosition-1;
document.getElementById("pictureIndex").innerHTML = currentPosition + 1;
//hide/show controls
manageNav(currentPosition);
clearInterval(slideShowInterval);
slideShowInterval = setInterval(changePosition, speed);
moveSlide(slideWidth, currentPosition);
console.log('end of nav function');
});
$img.on('click', function(){
var path = traverseData(imgData,'path', $(this));
window.location.assign("picturePage.html?name ="+path.name);
return;
});
当调用$nav
事件并执行其方法时,第二个事件被调用,但是在$nav
而不是$img
上,当然它不起作用,因为{{1 }}不能用于$nav
函数。我尝试过一切,但每次都会发生!请帮我!