Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:15:04+00:00 2026-05-23T09:15:04+00:00

Using the prettyPhoto plugin to open modal-style content containers, and trying to integrate with

  • 0

Using the prettyPhoto plugin to open modal-style content containers, and trying to integrate with Google Analytics’ Event Tracking to track when videos get opened.

Trouble is, when I

$('a.videoClickListener').click(function(event){
    console.log('here');
    _gaq.push(['_trackEvent', 'Product Page', 'Video Open', '<?php echo $product->getNameWithManufacturer(); ?>']);
});

the event is never fired, as prettyPhoto stops the event from continuing (quite rightly, as otherwise the page would change if a hyperlink was clicked).

prettyPhoto does not seem to provide an ‘open’ callback function, but if it did I couldn’t use it anyway, as the prettyPhoto listeners are set up somewhere in the layout (we use rel="prettyPhoto" every time we want to use prettyPhoto, and pass params through the URL, which is the prettyPhoto-recommended way of doing things). I would also like to pass the product details to Analytics, ruling out a global video-opening listener across all prettyPhoto opening events.

How can I bind my listener before the prettyPhoto listener? If it turns out I have to use .unbind(), then bind my listener, and then rebind prettyPhoto, how can I unbind a handler specified in a plugin?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:15:05+00:00Added an answer on May 23, 2026 at 9:15 am

    Ideally, you would be able to add your event binding before any others, so that it executes first.

    Unfortunately, jQuery doesn’t seem to include any such facility.

    However, I’ve coded a preBind method, which seems to do the trick:

    $.fn.preBind = function(type, data, fn) {
      this.bind(type, data, fn);
    
      var currentBindings = this.data('events')[type];
      var currentBindingsLastIndex = currentBindings.length - 1;
    
      var newBindings = [];
    
      newBindings.push(currentBindings[currentBindingsLastIndex]);
    
      $.each(currentBindings, function (index) {
        if (index < currentBindingsLastIndex)
          newBindings.push(this);
      });
    
      this.data('events')[type] = newBindings;
    
      return this;
    };
    

    Usage:

    $('#button').bind('click', function() {
      console.log('world');
    });
    
    // 2nd apostrophe for the selector was missing
    $('#button').preBind('click', function() {
      console.log('hello');
    });
    
    $('#button').click();
    
    // Output:
    //
    // > "hello"
    // > "world"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using prettyphoto jquery plugin for lightbox. When somebody clicks on a link it
I'm using the PrettyPhoto jQuery plugin for an image gallery, and I'd like to
I was trying to add popup helpers on my page using prettyPhoto ( link
I am using PrettyPhoto lightbox, and trying to set a rel attribute on a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I am using Fred LeBlancs roundabout plugin and I have incorporated a lightbox to
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
Using the navigator.geolocation object in JavaScript. Trying to establish accurate ranges, but wondering exactly
Hi I am using Jquery PrettyPhoto and want to always show the Next and
I am using the fantastic PrettyPhoto Lightbox, a Jquery lightbox clone. To launch a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.