Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4606736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:36:24+00:00 2026-05-22T00:36:24+00:00

The current plugin, shown below, scrolls the top-most div in a series of divs

  • 0

The current plugin, shown below, scrolls the top-most div in a series of divs with the same class upwards, then removes it from the container, and appends it to the bottom of the series (within the container). This gives the illusion of a vertical slideshow.

$.fn.rotateEach = function ( opts ) {
    var $this = this,
        defaults = {
            delay: 5000
        },
        settings = $.extend(defaults, opts),
        rotator = function ($elems) {
            $elems.eq(0).slideUp(500, function(){
                var $eq0 = $elems.eq(0).detach();
                $elems.parent().append($eq0);
                $eq0.fadeIn();

                setTimeout(function(){ rotator( $($elems.selector) ); },
                           settings.delay);
            });
        };

    setTimeout(function(){ rotator( $this ); }, settings.delay);
};

$('.dynPanelContent').rotateEach();

However, if there are a large number of elements to scroll through, this would make for a VERY long page. As such, I am attempting to re-write this script so that it accepts a parameter which will determine how many elements to display. Any elements exceeding this number will be hidden until they are in the top ‘x’ number of elements. Here is an example of what I have attempted to implement.

$.fn.rotateEach = function (opts) {
    var $this = this,
        defaults = {
            delay: 5000,
            //Add a parameter named elementsShown, pass in a default value of 3
            elementsShown: 3
        },
        settings = $.extend(defaults, opts),
        rotator = function ($elems) {
            //Hide the elements that are past the number to be shown
            for (i = settings.elementsShown; i <= $elems.eq; i++) {
                $elems.eq(i).hide();
            }
            $elems.eq(0).slideUp(500, function () {
                var $eq0 = $elems.eq(0).detach();
                var $eqN = $elems.eq(settings.elementsShown) - 1;
                //Check & Show the element that is now within the show range
                if ($elems.eq() == $eqN) {
                    $elems.eq($eqN).show('slow');
                }
                $elems.parent().append($eq0);
                $eq0.fadeIn();

                setTimeout(function () { rotator($($elems.selector)); },
                           settings.delay);
            });
        };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:36:25+00:00Added an answer on May 22, 2026 at 12:36 am

    You can use simple CSS for this, mate.

    If your elements are all of the same height (which your problem has to assume: if you are rotating a whole bunch of things dynamically, you won’t want your page to change height), then you don’t really need to use JavaScript for this at all. Just set the height of the container to what you want and hide the overflow. Then when you remove and append, everything appears to work. This won’t take care of your dynamic configuration, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My code is as below. Html Portion <div id=div_video> <div class=div_vol> <a href=# onclick=sound_adjustment()><img
The current implementation of Remy Sharp's jQuery tag suggestion plugin only checks for matches
How does a plugin add a page to the current WordPress theme a given
I wonder if there is a plugin that is able to save the current
I am trying to create a Jquery Tree plugin for my current project. In
Is there any way to show the current PHP function or class name in
I installed Eclipse with Flex plugin. And I found in my current workspace, IntelliSense
I'm beginning with backbone.js Going through some tutorials, like the one shown below. I
i use the validate plugin a lot - its great. my current setup, is
I am trying to create a jquery treeview plugin for my current project. Plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.