当浏览器 url 中出现#X 时,这部分应该触发点击图像......但它永远不会发生......
//
var hash = window.location.hash.slice(1);
if (hash) {
$("#barely_slide img[data-imgnum='"+ hash +"']").trigger("click");
} else {
move_slide();
}
需要触发的实际部分:
//
$("#barely_slide article img").on("click", function(){
if ($(this).attr("class") == "focus") {return false;}
//
$("#barely_slide article img").removeClass("previous");
$("#barely_slide article .focus").addClass("previous");
var image = $(this);
$(".previous").animate({"height":300,"margin-top":0}, "fast");
$("#barely_slide article .focus").removeClass("focus");
image.addClass("focus");
//
window.location.hash = image.attr("data-imgnum");
//
move_slide();
return false;
});