Okay I'm really really scratching my head at this one... so I have an arrow key navigation javascript (that I got a bit of help with previously; viewtopic.php?f=4&t=10536) to navigate through comic pages using left and right arrow, and it's been working like a charm.

But recently I discovered that it's suddenly just... not working. Nothing happens when I press the arrow keys.

I thought at first that I'd messed up the code, since I'd been working on the template that has it (I have a frustrating ability to do that haha), but I checked an old live test site which had the same script (albeit without the above mentioned fix), which I knew had been working when I uploaded it and which I also knew I hadn't messed with at all since then - and it's the same thing there; it's not reacting at all when pressing the arrow keys.

I've tried examining the code, checked on two different computers, different browsers etc and the issue persist. I have no idea if it's something with couchcms, the script or something else @__@

Anyway, the script looks like this;
Code: Select all
<script type="text/javascript">
    $(document).ready(function() {
            document.onkeydown = function()
                {
                    var j = event.keyIdentifier
                    if (j == "Right" && nextUrl)
                        window.location = nextUrl
                    else if (j == "Left" && prevUrl)
                        window.location = prevUrl           
                        }
                   });

      $(document).ready(function() {
                    var nextPage = $("#comic_next_page")
                    var prevPage = $("#comic_prev_page")
                    nextUrl = nextPage.attr("href")
                    prevUrl = prevPage.attr("href")
                });

</script>


And one of the 2 snippets with the html (with some unrelated list items cut out) looks like this;
Code: Select all
<ul class="comicnav_list">
   <li class="comicnavli">
      <cms:if k_prev_nestedpage_link >
         <a id="comic_prev_page" href="<cms:show k_prev_nestedpage_link />"><img width="50" src="<cms:show k_site_link />images/cPrev.png" border='0'><br/>Previous</a>
      <cms:else />
         <img width="50" src="<cms:show k_site_link />images/cPrev.png" border='0'><br/>
         Previous
      </cms:if>
   </li>
</ul>