Question

I am trying to implement a simple hover effect so when I hover over each project, the description slides in from the right.

So far, I have this set up: http://jsfiddle.net/gnnSB/

In that fiddle, notice that the descriptions don't slide in when you hover over them with the mouse, yet the filtering works well.

Now, take a look at this example: http://jsfiddle.net/gnnSB/1/

Here, the descriptions do slide in, but the filtering doesn't work because I took out the Quicksand function (shown below).

I need both of these to work together. There is a conflict and I'm wondering if anybody has experienced anything similar. Is this a simple fix or do I need to resort to another solution?

Quicksand

$(function() {

    var time_effect = 400;
    var effect_name = 'easeOutQuart';

    $('.all').quicksand( $('.everything article'), {
        duration: time_effect,
        attribute: 'data-id',
        easing: effect_name,
        adjustHeight: 'auto',
        useScaling: false
      });

    $('.filter-all').click(function(e) {
      $('.all').quicksand( $('.everything article'), {
        duration: time_effect,
        attribute: 'data-id',
        easing: effect_name,
        adjustHeight: 'auto',
        useScaling: false
      });
      $('.filter a').removeClass('selected');
      $(this).addClass('selected');
      e.preventDefault();
    });

    $('.filter-web').click(function(e) {
      $('.all').quicksand( $('.web article'), {
        duration: time_effect,
        attribute: 'data-id',
        easing: effect_name,
        adjustHeight: 'auto',
        useScaling: false
      });
      $('.filter a').removeClass('selected');
      $(this).addClass('selected');
      e.preventDefault();
    });

    $('.filter-print').click(function(e) {
      $('.all').quicksand( $('.print article'), {
        duration: time_effect,
        attribute: 'data-id',
        easing: effect_name,
        adjustHeight: 'auto',
        useScaling: false
      });
      $('.filter a').removeClass('selected');
      $(this).addClass('selected');
      e.preventDefault();
    });
  });

Hovers

$('.thumbnail').hover(function () {
    $('.description', this).stop().animate({
      right: 0
    }, 50);
  }, function () {
    $('.description', this).stop().animate({
      right: -280
    }, 50);
  });

Edit: Is there a way to add multiple enhancements? I'm trying to incorporate fancybox.

// Fancybox
    var fbox = function() {
                $("a.single-image").fancybox({
                    'transitionIn'   : 'none',
                    'transitionOut'  : 'none',
                    'overlayColor'   : '#000',
                    'overlayOpacity' : '0.6'
                });
    };
Was it helpful?

Solution

Is this what you need? Edit: Refactored Fiddle link

You need to add another config (enhancement) for quicksand wherein you'll put the hover functions:

enhancement: function() {
              $('.thumbnail').hover(function () {
                    $('.description', this).stop().animate({
                      right: 0
                    }, 50);
                  }, function () {
                    $('.description', this).stop().animate({
                      right: -280
                    }, 50);
                  });
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top