2

I'm using quicksand but I'd like to add a hover effect inside the element that is filtered by Quicksand jquery.

(function ($) {
    var $itemsHolder = $('ul.proyectosthumb');
    var $itemsClone = $itemsHolder.clone(); 
    var $filterClass = "";
    $('ul.filter li').click(function(e) {
        e.preventDefault();
        $filterClass = $(this).attr('data-value');
        if ($filterClass == 'all') { 
            var $filters = $itemsClone.find('li'); 
        }
        else { 
            var $filters = $itemsClone.find('li[data-type='+ $filterClass +']'); 
        }
        $itemsHolder.quicksand($filters);
    });
}(jQuery));

Function for hover effect:

$('.thumbnail').hover(
    function(){
        $(this).find('.caption-hover').fadeIn(250); //.fadeIn(250)
    },
    function(){
        $(this).find('.caption-hover').fadeOut(250); //.fadeOut(205)
    }
); 

Any Idea to add this function inside Quicksand?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
David
  • 2,283
  • 2
  • 14
  • 16
  • possible duplicate of [How to bind .hover() to dynamically created "li" elemtent?](http://stackoverflow.com/questions/14950321/how-to-bind-hover-to-dynamically-created-li-elemtent) – Nishit Maheta Apr 15 '15 at 12:09

1 Answers1

1

I also had the same issue with quick sand elemnts question here. this worked for me.use this function .this may help .

jQuery(document).on('hover',".thumbnail",function(){

     //code here .
        });

reason behind this is

The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. check full desc

Community
  • 1
  • 1
Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68