我使用的是WordPress。WordPress的附件页面导航键盘
我想导航我的附件页left and right key。
这是我的代码,但不工作;
function GoToLocation(url)
{
window.location = url;
}
Mousetrap.bind("j", function() {
//alert('j pressed' + document.getElementById("next").href);
//document.getElementById("next").click();
window.location=<?php echo $image->next_image_link ?>;
});
<script src="https://craig.global.ssl.fastly.net/js/rainbow-custom.min.js?39e99"></script>
<script src="https://craig.global.ssl.fastly.net/js/mousetrap/mousetrap.js?bc893"></script>
如果我改变
window.location=<?php echo $image->next_image_link ?>;
这个
window.location="http://mylink.com";
脚本运作良好。但我不能使用基于WordPress的链接(如next_image_link();)
我该怎么办?
感谢您的帮助,但是当我用编辑的代码按“j”时,页面正在重新加载相同的URL。 – ceylankral
我做了一个编辑,现在应该没问题。 – pr0gramist