Click to switch divs

I am struggling and in need of help. I have been trying to rotate divs on click using jQuery, which was successful until I had two sets of divs that needed to be rotated independently on the same page. When clicking on the arrows to rotate the content in the second set, both sets of divs are rotating simultaneously. I want them to be separate so that each group can be rotated independently.

    $(document).ready(function(){
        $("#cslide-slides").cslide();
    });
    /*=Slides
    ----------------------------------------------- */
    .cslide-slides-master {
      overflow: hidden;
     }
    
    .cslide-slides-master:last-child {
      margin-bottom: 0; }
    
    .cslide-slides-container {
      visibility: hidden; }
    
    .cslide-slide {
      float: left;
     }
    /* prev next buttons */
    .cslide-prev-next {
      display: none;
      -webkit-touch-callout: none;
      -webkit-user-select: none;
      -khtml-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none; }
    
    .cslide-prev, .cslide-next {
      display: inline-block;
      float: right;
    
      padding: 10px 5px;
    
      cursor: pointer; }
    
    .cslide-prev.cslide-disabled:hover,
    .cslide-next.cslide-disabled:hover {
     }
    
    .cslide-disabled {
      opacity: 0.3; }
<div id="Cell">
    <section id="cslide-slides" class="cslide-slides-master clearfix">
    
                <div class="cslide-slides-container clearfix">
                    <div class="cslide-slide">h4>Insert update headline here</h4>
                        <p>Some text that describes this update</p>
    
                    </div>
                    <div class="cslide-slide">h4>Update 2</h4>
                        <p>Some text that describes this update</p>
                    </div>
                    <div class="cslide-slide"><h4>Update 3</h4><p>Some text that describes this update</p>
                    </div>
                    <div class="cslide-slide">h4>Update 4</h4><p>Some text that describes this update</p>
                    </div>
                    <div class="cslide-slide"><h4>Update 5</h4><p>Some text that describes this update</p>
                    </div>
    
                </div>
                <div class="cslide-prev-next clearfix"><span class="cslide-next"><img src="images/Arrows_navigation_right.png" alt="Right" width="20" height="20"></span>
                    <span class="cslide-prev"><img src="images/Arrows_navigation_left.png" alt="Left" width="20" height="20"></span>
    
                </div>
            </section><!-- /sliding content section -->
    
    
      </div>
      <p>&nbsp;</p>
      
      <div id="Cell">
    
    <p class="line">&nbsp;</p>
    
    <section id="cslide-slides" class="cslide-slides-master clearfix">
    
                <div class="cslide-slides-container clearfix">
                    <div class="cslide-slide"><h4>Insert update headline here</h4>
                        <p>Some text that describes this update</p>
    
                    </div>
                    <div class="cslide-slide"><h4>Update 2</h4>
                        <p>Some text that describes this update</p><a href="PolicyUpdates.html#PolicyUpdate2">Read more</a>
                    </div>
                    <div class="cslide-slide"><h4>Update 3</h4><p>Some text that describes this update</p>
                    </div>
                    <div class="cslide-slide"><h4>Update 4</h4><p>Some text that describes this update</p>
                    </div>
                    <div class="cslide-slide"><h4>Update 5</h4><p>Some text that describes this update</p>
                    </div>
    
                </div>
                <div class="cslide-prev-next clearfix"><span class="cslide-next"><img src="images/Arrows_navigation_right.png" alt="Right" width="20" height="20"></span>
                    <span class="cslide-prev"><img src="images/Arrows_navigation_left.png" alt="Left" width="20" height="20"></span>
    
                </div>
            </section><!-- /sliding content section -->
    </div>


    <script type="text/javascript" src="jquery.cslide.js">

Answer №1

It’s important to initialize a separate instance of cslide for each slider and ensure that IDs are unique without repetition on the same page. Utilize classes for this purpose.

Assign a distinct ID to each slider and initialize them using the class if permitted by the plugin. If not, resort to utilizing unique IDs.

<script type="text/javascript" src="jquery.cslide.js"></script>  
<script>
$( document ).ready( function () {
  $( '.cslide-slides-master' ).cslide();
} );
</script>

Consider using a more recent slider as the current one has not been updated for over 4 years.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

the button function is unresponsive

Can someone please help me troubleshoot my jQuery code? Everything seems fine, but the generate button is not working when clicked! PS: I've searched extensively for a solution to this problem but haven't been able to find one. I've also at ...

The concept of Ajax and checkbox arrays

I recently started working with Ajax and tried following a tutorial from this source However, I encountered some issues while trying to make it work. Can someone please assist me with this? Below is the HTML code that I am using: <html> <head ...

The app constantly requests permission for geolocation services

While experimenting with the geolocation API, I encountered an issue where my page kept repeatedly asking for permission upon refresh. To work around this problem, I attempted to save my coordinate data to local storage but encountered difficulties in ma ...

Avoiding Backbone Routing Conflicts when Implementing CSS3 Targeting

I have implemented a CSS target to create some basic animation in my Backbone project. However, I am facing an issue where the method I am currently using adds a #banner to the URL, which Backbone tries to interpret as a route if users refresh the page aft ...

Proceed with the next AJAX request only when the previous one has successfully completed

Currently, I am working on a process where PDFs are generated in the background using AJAX calls. The generation of these PDF files usually takes around one second each. Although the process is functional, I have encountered an issue with memory depletion ...

What steps are involved in creating a circular shape on canvas?

I am trying to create a circular shape in the canvas using the code below. The code involves moving an object with keyboard keys, and I need help making the canvas shape into a circle without affecting the functionality of the code. I attempted to modify t ...

Tips for incorporating a simple jQuery table

Is there a way to incorporate a simple table with 2 columns and 10 rows on a specific section of a webpage? The table will consist of 10 dynamic entries that are refreshed manually from the back-end DB. The second column of each entry will contain a bit.ly ...

The function SVGGeometryElement.isPointInFill() may not function correctly in Chromium, but it does work properly in Firefox

I'm currently working on a solution to detect when a path within an SVG file on a canvas has been clicked. The code I've written functions correctly in Firefox, but I'm encountering issues with Chromium browsers. When I surround the code wit ...

Is it possible to nest a parsys within another parsys in this context?

On my webpage, I have a paragraph system (parsys) with a component that contains two inner paragraph systems. When I try to add a rich text component to each of these inner paragraph systems, the components overlap and become uneditable. Is it possible t ...

Is it feasible to have content wrap around a Grid-Item?

I've been experimenting with the new CSS Grids layout module to arrange my content. I have a set of paragraphs that are 8 columns wide, and I'm looking to insert a figure that spans 3 columns in columns 1-3. After that, I want the following parag ...

How to implement a Django block for loading CSS files

I have multiple pages and I need to load unique CSS for each page. I am using this method for all static files. In the head of my index.html file, I have the following code: {% block css %} {% endblock %} However, in my contact.html file, I have the fol ...

Bootstrap-4 modal not appearing when activated within a dropdown menu

When I tried to use a dropdown feature in my application, I encountered an issue where one of the dropdown items was supposed to open a modal but it wasn't showing up. However, the modal worked perfectly fine when I accessed it using a normal button i ...

Issue with Chrome extension: inability to submit values

My Chrome extension is not functioning properly. Here is the code that I have: //manifest.json { "manifest_version": 2, "name": "auto login", "description": "This extension allows for automatic logins.", "version": "1.0", "permissions ...

Encountering a problem with quintus-all.js and need assistance

I am having an issue with my animation code. Can someone help me troubleshoot it? window.addEventListener('load', function(){ var Q =window.Q= Quintus().include("Sprites, Scenes,2D, Anim").setup({maximize:true}); Q.Sprite.extend(&apos ...

Altering the display attribute cancels out any opacity transitions

When using JavaScript to change the opacity of an element with transition: opacity 1s, the expected duration of one second is met, as demonstrated here: onload = e => { var p = document.getElementsByTagName("p")[0]; p.style.opacity = 1; }; p { ...

To ensure that any changes made to data are reflected automatically when viewing data in Angular 2

In the process of developing an Angular 2 application, I encountered a scenario that requires special attention. The data displayed on the view is fetched from an API, with certain fields being editable by the user. These modifications can be saved using ...

Increase the date by one day excluding weekends (Saturday and Sunday)

My current code is designed to add +1 day to the current date. var date = '30 Apr 2010'; var actual_date = new Date(date); var final_date = new Date(actual_date.getFullYear(), actual_date.getMonth(), actual_date.getDate()+1); Now, I am looking ...

Endless Loading in Node.js on Google App Engine

I have deployed a standard nodejs app (free tier) using cloud shell, but when I try to access https://[ID].du.r.appspot.com/ , it keeps loading indefinitely. app.js: const express = require('express'); const path = require('path'); co ...

Guide to horizontally aligning a div with a dynamic width in the center

After extensive research, I discovered that setting a width allows you to center a div using margin: 0 auto along with left: 0;, right: 0, and position: absolute. However, all the examples I found had a specified width. In my specific case, I need to cent ...

Block of white colors located on the right side beyond the confines of an HTML structure

I am encountering an issue where a white block is appearing outside the HTML on my page. Despite having no content, Firebug indicates that it is located outside the html tag. I suspect the problem may be related to an image that is too wide or padding exc ...