作者:你就是一朵奇葩_518 | 来源:互联网 | 2023-05-17 13:00
IamaphotographerandhaveawebsitewhereIamunabletoeditthetemplatestructurebutcanup
I am a photographer and have a website where I am unable to edit the 'template' structure but can upload Javascript/css etc.
我是一个摄影师,有一个网站,我不能编辑“模板”结构,但可以上传Javascript/css等。
I want to bind next/prev navigation to keyboard right/left.
我要绑定next/prev导航到键盘右/左。
The structure of the links are:
各环节的结构为:
I referred to this and managed to create this.
我引用了这个,并设法创建了这个。
$(function() {$(document).keyup(function(e) {
switch(e.keyCode) { case 37 : window.location = $('li.prev').attr('href'); break;
case 39 : window.location = $('li.next').attr('href'); break; }});});
This is where I am stuck. It does not work because it assumes the I am refereing to a href tag but am refering to the li that contains it.
这就是我被困住的地方。它不起作用,因为它假设I是引用一个href标记,而是引用包含它的li。
Any ideas would be much appreciated!
非常感谢您的任何想法!
4 个解决方案