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 9073695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:28:30+00:00 2026-06-16T18:28:30+00:00

Can someone recommend me some jQuery plugin, for the rotating this HTML structure. <div

  • 0

Can someone recommend me some jQuery plugin, for the rotating this HTML structure.

<div id="event_rotator">
 <div class="event">
 <h2>Title</h2>
 <p>Text</p>
 </div>
 <div class="event">
 <h2>Title</h2>
 <p>Text</p>
 </div>
 <div class="event">
 <h2>Title</h2>
 <p>Text</p>
 </div>
</div>

I would like, that it would rotate the automatically in the certain time period, when the user is on the page, and also that user can rotate it left and right with a click on an arrow.

I tried to use this http://jquery.malsup.com/cycle/pager11.html , but I cannot get it to work.

The problem is, that I get this HTML dynamically, out of a PHP code.. I don’t know, how to assign the needed css (I can assign that which is the same for all, but I cannot assign different Z-index.

  • 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-06-16T18:28:33+00:00Added an answer on June 16, 2026 at 6:28 pm

    I created this in 10 min, so it’s not a designer’s gallery, but this one has all you need to use and LEARN how to create your self a slide gallery with left/right buttons, auto-rotate and hover/pause.

    The HTML,CSS,JS code is really simple so take a look:

    http://jsbin.com/ofukaq/8/edit

    HTML:

    <div id="event_rotator">
    
      <button id="left">left</button>
      <button id="right">right</button>  
    
      <div id="slider">
       
         <div class="event">
         <h2>Title1</h2>
         <p>Text1</p>
         </div>
         <div class="event">
         <h2>Title2</h2>
         <p>Text2</p>
         </div>
         <div class="event">
         <h2>Title3</h2>
         <p>Text3</p>
         </div>
       
      </div>
      
    </div>
    

    CSS:

    #event_rotator{
      width:300px;
      height:150px;
      position:relative;
      overflow:hidden;
    }
    #slider{
      position:absolute;
      height:150px;
      left:0; 
      width:99999px;
    }
    .event{
      float:left;
      width:300px;
      height:150px;
      background:#eee;
    }
    

    and finally jQuery:

    $(function(){
    
    var W = $('#event_rotator').width();      // Gallery Width
    var N = $('#slider .event').length;    // Number of elements
    var C = 0;                          // Counter
    var intv;                         // Auto anim. Interval
    
    
    if(N<=1){ 
      $('#left, #right').hide();  // hide buttons only 1 element
    }  
    
    
    $('#slider').width( W*N );          // Set slider width
    
    $('#left, #right').click(function(){
      // Animation logic
      if(this.id=='right'){
        
        C++;
        C = C % N;     // reset to '0' if end reached
        
      }else{ // left was clicked
        
        C--;
        if(C===-1){   // IF C turns -1 scroll to last one (N-1)
          C = N-1; 
        }
        
      }
      // Animation
      $('#slider').stop().animate({left: -C*W }, 1000 );
    });
    
    
    // auto rotate
    
    function autoRotate(){
      intv = setInterval(function(){
          $('#right').click();
      },2000); // pause time
    }
    autoRotate(); // start auto rotate
    
    // pause hover
    
    $('#event_rotator').on('mouseenter mouseleave', function( e ){
       var mEnt = e.type=='mouseenter';
      if(mEnt){
         clearInterval(intv);
      }else{
         autoRotate();
      }
    });
    
    }); // * end document ready.
    

    Hope I opened your eyes that sometimes you don’t need a 3000 lines plugin to build a nice gallery with all the functionality you need.


    Here is with a bit compressed jQuery script using Ternary operators:

    jsBin demo

    var W = $('#event_rotator').width(),
        N = $('#slider .event').length,
        C = 0,
        intv;
    
    if(N<=1)$('#left, #right').hide(); 
    $('#slider').width( W*N );
    
    $('#left, #right').click(function(){
         C = (this.id=='right'? ++C : --C) < 0 ? N-1 : C%N ;
         $('#slider').stop().animate({left: -C*W }, 700 );
    });
    
    function auto(){
      intv = setInterval(function(){
          $('#right').click();
      }, 3000 );
    }
    auto();
    
    $('#event_rotator').hover(function( e ){
      return e.type=='mouseenter' ? clearInterval(intv) : auto();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone recommend some simple and secure PHP/MySQL Database class for the database interaction?
Can someone please tell me what this means: 07-04 09:54:38.048: I/DetailActivity(15496): Title that is
Can someone recommend a reliable HTML tree control that also supports tree manipulation? I
Can some one recommend any free program which counts the number of clicks Clicked
Can someone recommend an up to date library for data Sanitization in PHP ?
Can someone recommend a good, open source, standalone developer tool for querying SQL databases
Can someone recommend a payment gateway that allows incremental (irregularly recurring) charges to the
Can someone recommend a simple c# code generator. I just looking something with methods
Can someone recommend a hosted solution that answers the following requirements (I have seen
Can someone please explain why ?___SID=U is appearing in some Magento URLs on my

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.