www.webdeveloper.com
Results 1 to 3 of 3

Thread: Override Ctrl+Click default action

  1. #1
    Join Date
    Mar 2008
    Posts
    175

    Override Ctrl+Click default action

    I have this image gallery using Lightbox 2.0, as such each thumbnail must be a click-able link to the image itself -- lightbox then displays that into a floating div instead.

    So the problem, is that before the images were click-able via lightbox one could ctrl+click the thumbnail to highlight it (via a CSS border). Since the thumbnails are now links, when I ctrl+click them the current browser instead performs a default action, usually opening the image in a new tab.

    Is there a way to over ride this default behavior?

    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Since some browsers allow any mouse button combinations to be set to do whatever you want them to do, web pages should never try to override those actions unless you want to convince people that your site is broken. Let people use whatever method they usually use to select things when they need to select them.

    If your lightbox script is overriding the default actions for that combination to stop it doing what your browser is set to use that combination for then remove the code from the script that is causing the problem.
    Last edited by felgall; 11-06-2008 at 12:58 PM.
    Stephen

  3. #3
    Join Date
    Mar 2008
    Posts
    175
    It makes sense not to override the default browser behavior for the reason you mentioned. I'll have to brainstorm this one further. The problem is I want users to select images by clicking them in some way, but they are links as well so clicking them generally opens them when I just want to trigger some javascript.

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles