Comments on: Simple jQuery Spy Effect http://jqueryfordesigners.com/simple-jquery-spy-effect/ Tutorials and screencasts Thu, 22 Sep 2011 12:58:42 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: David Peters http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-7211 David Peters Wed, 13 Jan 2010 19:44:47 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-7211 <p>This is awesome!</p> This is awesome!

]]>
By: fukid http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-7173 fukid Fri, 08 Jan 2010 16:59:08 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-7173 <p>this is the version with modified 1) slightly random interval 2) support dynamic height</p> <p><code></p> <pre><code>(function ($) { </code></pre> <p>$.fn.simpleSpy = function (limit, interval) { limit = limit || 4; interval = 20000; return this.each(function () { var $list = $(this), items = [], itemsHeight=[], currentItem = limit, total = 0, height = $list.find('> li:first').height(); $list.find('> li').each(function () { itemsHeight.push($(this).height()); items.push('<li>' + $(this).html() + '</li>'); }); total = items.length; $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove(); function spy() { interval = 20000; interval = interval *Math.random(); var $insert = $(items[currentItem]).css({ height : 0, opacity : 0, display : 'none' }).prependTo($list); $list.find('> li:last').animate({ opacity : 0}, 1000, function () { $insert.animate({ height : itemsHeight[currentItem-1] }, 1000).animate({ opacity : 1 }, 1000); $(this).animate({ height : 0 }, 1000, function () { $(this).remove(); }); }); currentItem++; if (currentItem >= total) { currentItem = 0; } setTimeout(spy, interval); } spy(); }); };<br /> })(jQuery); </code></p> this is the version with modified 1) slightly random interval 2) support dynamic height

(function ($) {

$.fn.simpleSpy = function (limit, interval) { limit = limit || 4; interval = 20000; return this.each(function () { var $list = $(this), items = [], itemsHeight=[], currentItem = limit, total = 0, height = $list.find('> li:first').height(); $list.find('> li').each(function () { itemsHeight.push($(this).height()); items.push('

  • ' + $(this).html() + '
  • '); }); total = items.length; $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove(); function spy() { interval = 20000; interval = interval *Math.random(); var $insert = $(items[currentItem]).css({ height : 0, opacity : 0, display : 'none' }).prependTo($list); $list.find('> li:last').animate({ opacity : 0}, 1000, function () { $insert.animate({ height : itemsHeight[currentItem-1] }, 1000).animate({ opacity : 1 }, 1000); $(this).animate({ height : 0 }, 1000, function () { $(this).remove(); }); }); currentItem++; if (currentItem >= total) { currentItem = 0; } setTimeout(spy, interval); } spy(); }); };
    })(jQuery);

    ]]>
    By: Andrew http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-7083 Andrew Wed, 09 Dec 2009 10:30:06 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-7083 <p>Is there any way of getting the script to run the other way round? </p> <p>ie removing top item and adding new item tothe bottom?</p> Is there any way of getting the script to run the other way round?

    ie removing top item and adding new item tothe bottom?

    ]]>
    By: Crome http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-6942 Crome Mon, 09 Nov 2009 15:00:07 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-6942 <p>This is a great script! I would love to use it with some kind of navigation/pagination system, is it possible?</p> This is a great script! I would love to use it with some kind of navigation/pagination system, is it possible?

    ]]>
    By: florent http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-6743 florent Mon, 12 Oct 2009 13:05:31 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-6743 <p>hello, 1 st : very nice effect</p> <p>2 nd : it is possible to scroll left to right and don't Up to Down ?</p> hello, 1 st : very nice effect

    2 nd : it is possible to scroll left to right and don’t Up to Down ?

    ]]>
    By: Ben http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-6535 Ben Sat, 03 Oct 2009 18:17:16 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-6535 <p>How can I make it so this script won't do anything in IE7? since IE7 bugs like a mofo.</p> How can I make it so this script won’t do anything in IE7? since IE7 bugs like a mofo.

    ]]>
    By: Lance http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-6407 Lance Wed, 30 Sep 2009 18:59:11 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-6407 <p>Just curious if anyone could help show me how to make the images go from left to right (or right to left) .</p> <p>thanks! L</p> Just curious if anyone could help show me how to make the images go from left to right (or right to left) .

    thanks! L

    ]]>
    By: Ben http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-6388 Ben Tue, 29 Sep 2009 21:55:13 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-6388 <p>This doesn't seem to work on IE7. Which is strange, because it does work in ie8 / ie6... any help?</p> This doesn’t seem to work on IE7. Which is strange, because it does work in ie8 / ie6… any help?

    ]]>
    By: Free.Styler_1@yahoo.com http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-5652 Free.Styler_1@yahoo.com Sat, 05 Sep 2009 23:22:19 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-5652 <p>Very Cool Effect... But please guys, How can i put 2 buttons in the top and in the bottom of the list to move the elements up and down manually ???</p> Very Cool Effect… But please guys, How can i put 2 buttons in the top and in the bottom of the list to move the elements up and down manually ???

    ]]>
    By: kamal http://jqueryfordesigners.com/simple-jquery-spy-effect/comment-page-3/#comment-5574 kamal Sat, 29 Aug 2009 16:19:32 +0000 http://jqueryfordesigners.com/simple-jquery-spy-effect/#comment-5574 <p>Thanks for this ^power effect, so power.</p> Thanks for this ^power effect, so power.

    ]]>