jQuery Galleriffic Plugin History Update

Posted: December 15, 2011 in JavaScript

Using the Galleriffic version 2.0.1 you will find it incompatible with the 2010-09-11 jQuery History plugin. It currently only works with the 2009 history plugin version.

When you insert the pageload function and its calls into your HTML, update it to the following. Lines 3 and 15 are updated.

// Initialize history plugin.
 // The callback is called at once by present location.hash.
 $.history.init(pageload);

// set onlick event for buttons using the jQuery 1.3 live method
 $("a[rel='history']").live('click', function(e) {
 if (e.button != 0) return true;

 var hash = this.href;
 hash = hash.replace(/^.*#/, '');

// moves to a new page.
 // pageload is called at once.
 // hash don't contain "#", "?"
 $.history.load(hash);

return false;
 });

Then update jquery.galleriffic.js:
Line 495:

$.history.load(String(imageData.hash));

Line 868:

if (this.enableHistory && !$.history.init)
About these ads
Comments
  1. Ryan says:

    Hi. Could you explain what you did to get it to work? I under stand changing line 495 and 868 in jquery.galleriffic.js. However, where is the code above that supposed to go? All the “Initialize history plugin stuff” thanks.

  2. richt48 says:

    Hi, this doesn’t appear to work for me. I’ve changed the code in my HTML page and in jquery.galleriffic.js but what happens is I lose the main gallery image and get errors thrown up in the IE console referring to the history.init function. I’ve put my code back to how it was now so can’t post the exact error unfortunately. Any ideas why this isn’t working for me? Thanks in advance, Rich

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s