Support » Plugins » Hacks » Keyboard post navigation with Cleaner (Lightbox) Post Gallery

  • Hello,

    I am trying to implement navigation between posts using the instructions here:

    It works, except I also have a lightbox post gallery on the page (using the Hatch theme). So if I open lightbox and navigate between photos using the left and right arrows, it triggers the navigation between blog posts already but only goes to the next page once the lightbox is closed.

    I want to be able to keep these two navigation actions separate – perhaps having the post navigation be disabled while the lightbox is opened, though I’m not sure how this would be done.

    Thanks so much in advance!


Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    The navigation works by associating (binding) script to run on a particular key event. To do what you want, you need to attach your own script to run when the lightbox opens that removes the previous key binding. Then another script when the lightbox closes to restore the binding.

    Thanks so much for the info! I don’t have much experience with the intricacies of Lightbox, so how would I be able to detect with Lightbox is opened/closed from outside of the Lightbox script itself?

    Moderator bcworkz


    Yeah, well I have no experience, I only understand the general concept. No matter, it is a DOM object of the page document, which is all that really matters. There’s probably a way to do this with straight javascript, but jQuery would be more convenient, especially since it is part of WP anyway and perhaps the Lightbox plugin you’re using.

    Either way, you need to bind your own function to some event that happens when the lightbox opens. This could be a click on a thumbnail, or some element in the lightbox getting focus, or probably other events as well. After all, lightbox is triggered by some event itself. Unfortunately, I’m not well versed in Lightbox or jQuery. I only know enough to be certain there is way to accomplish this and have a vague idea of what needs to happen, so I can’t really give you any specifics, sorry.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Keyboard post navigation with Cleaner (Lightbox) Post Gallery’ is closed to new replies.