Thank you! Your feedback has been delivered
Thank you! Your feedback has been sent

Isotope and Fancybox - Have to click twice to filter

I am using an Isotope filter combined with a Fancybox gallery and have added some customised script so that Fancybox only scrolls through those images that are filtered.

The problem is that now to activate the Isotope filter I have to click twice on the filter menu to initialise it. I'm hoping someone may be able to spot the problem in my code to help me out. I've created a fiddle:

http://jsfiddle.net/DZ5NN/

I was advised that I needed to 'bind Isotope once to the whole container and then to the individual filter'. I added the 'bind to container' script to my custom script but it doesn't appear to have fixed it.

Any help appreciated.

User Gravatar

davidrk

Posted Jun 23 2013 10:14 UTC

$5


  • Assigned To NBoychev
  • Solved
  • jquery
    python
    isotope
  • 1891 Views

4 Replies


Hello davidrk, I'm glad to see that you are writing object oriented JS.

Now for your problem: You are are binding to the click event twice and you are returning false in the end of your code, so you are breaking other binds from initialise. To prevent the browser's default behavior it's better to use event.preventDefault().

I've eddited your fiddle:

http://jsfiddle.net/DZ5NN/1/

User Gravatar

NBoychev

Posted Jun 23 2013 13:37 UTC

Solution

This didn't solve your task? Get your own custom solution.

Unfortunately I\'ve just discovered that when using Mozilla or Explorer, this fix disables the original functionality of Fancybox only scrolling through filtered items. It works fine using Safari. For example the fiddle should only scroll through the enlarged red items when the red filter is selected. Any ideas?

User Gravatar

davidrk

Posted Jun 25 2013 13:35 UTC

Hello davidrk,

Sorry for that bug, it was my mistake. I forgot to pass 'event' as parameter of one of the functions. Here you go:

http://jsfiddle.net/DZ5NN/2/

Regards, Nikola Boychev

User Gravatar

NBoychev

Posted Jun 25 2013 19:28 UTC

That did the trick Nicola! Thanks again!

User Gravatar

davidrk

Posted Jun 25 2013 23:45 UTC

Add a reply

By posting a reply on CodersClan you agree to our Terms & Conditions