0

I've had a lot of help from stack overflow getting this page to where it is with its functionality and it's almost there, I'm just not a jQuery expert. Working example:

http://www.metropoliscreative.com/jake_test/test1.html

I'm using Galleriffic (a dynamic gallery jQuery plug) and Quicksand (a jQuery filtering plug).

If you click the thumbnails, they will load properly in the big pane. If you select project type or industry, it will sort those thumbnails based on some data types.

However, the issue is that once you sort them, the Galleriffic functionality stops working. So to correct this, I wrapped another galleriffic call within the quicksand initialization. So that once quicksand completes, it resets galleriffic.

However, I'm getting an error from galleriffic at this point and I'm not sure why. I'm calling the exact same way it is being called when the page loads and it works then.

Josh K
  • 28,364
  • 20
  • 86
  • 132
Redlist
  • 93
  • 3
  • 10

2 Answers2

2

When I looked at the source of your page, I saw a 'd' on line 295 (just before the problem zone) that shouldn't be there. Maybe that's the reason, your code doesn't get executed.

Kerstomaat
  • 673
  • 4
  • 13
0

It seems to be throwing an error because of your second .galleriffic() call. The error I get is Cannot convert 'imageData' to object. This appears to be because when you switch to (for example) Project Type -> Brochure Packages, gallerific tries to set the current image id to 0 based on the data attributes. However, it seems as though quicksand screws up the data array which causes gallerific to not see any elements (aka the images) on the second call. I think that quicksand is causing the issues, perhaps because it's not removing/adding the images properly. If you look at this example, the code for removing images is like this:

$('#removeImageByIndexLink').click(function(e) {
    if (!gallery.removeImageByIndex(5))
        alert('There is no longer an image at position 5 to remove!');

    e.preventDefault();
});

It seems, however, that quicksand just uses .remove() to get rid of the images. Now, I looked into the code for removeImageByIndex() and it seems that gallerific keeps a cache of information about the images it uses which does NOT get updated when .remove() gets called by quicksand.

tldr; Quicksand removes the images incorrectly and gallerific doesn't get updated to the changes.

How to fix it? Well, one option would be to try and rewrite the removal and addition parts of your quicksand script to be aware of gallerific. Another one would be to rewrite the removal parts of quicksand to only HIDE elements rather than remove them (ie. set display:none; instead of .remove()).

I hope this helps, that's about all I can come up with.

  • Drackir, Thank you so much for your response. I think I'm following what you're saying and I believe it makes sense. I'm in the quicksand js source and I see two lines that have a remove line (lines 80 and 300). I'm not quite sure how to start rewriting this. Could you offer any suggestions? I tried $dest.css('display':'none'); but it gave me an error... Coincidentally, when I deleted this line altogether, it stopped giving me an error and it appears Galleriffic isn't completely gone at that point. Any thoughts? – Redlist Jan 25 '11 at 19:58
  • @Redlist: Try `$toDelete.css('display','none');` for line 80 and likewise for line 300 with the `$dest` variable (note the syntax I use is a bit different). Don't forget, you'll have to find the spots where it adds the elements back in and change them to `.css('display','');` to reset them. I've only very briefly looked through the quicksand code. Just try to understand how it works: like where it puts the old elements (it must store them somewhere) and then modify it so that it doesn't save/remove/readd them, it just hides/shows them. – Richard Marskell - Drackir Jan 25 '11 at 20:33
  • Thank you Drackir, I really appreciate your help. Going to try this out. – Redlist Jan 25 '11 at 21:11
  • @Redlist: Good luck! Drop a comment if you need any more help. – Richard Marskell - Drackir Jan 25 '11 at 21:22