Struggling with creating a slideshow - is the display set to none?

I've been working on a jQuery slideshow project and have encountered an issue where a hidden element is not showing up as expected. Below is the code I'm using:

<section id="content">
    <div id="jumbotron">
        <div class="slide" class="first-slide">
            <img src="IMG/Jellyfish.jpg" class="large">
        </div>
        <div class="slide">
            <img src="IMG/Koala.jpg" class="large">
        </div>
        <div class="slide">
            <img src="IMG/Penguins.jpg" class="large">
        </div>
    </div>
</section>

CSS:

.slide{
    display:none; 
}
div.first-slide{
    display:block;
} 

I'm puzzled as to why the first image is not displaying, especially after setting it to display: block. Can anyone shed some light on this issue for me?

Any help would be greatly appreciated. Thanks!

Answer №1

You have utilized the class attribute twice. The css classes should be combined into a single class attribute.

For instance

    <div class="slide" class="first-slide">
        <img src="IMG/Jellyfish.jpg" class="large">
    </div>

Should be corrected to

    <div class="slide first-slide" >
        <img src="IMG/Jellyfish.jpg" class="large">
    </div>

Alternatively, if the first image always needs to be displayed, do not assign a class to the div at all.

    <div>
        <img src="IMG/Jellyfish.jpg" class="large">
    </div>

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

Determine the new total by adjusting the quantity and recalculating the amount

How can I find the total amount when the quantity is changed? I'm having trouble with this script within a while loop: (quantity * amount = total_amount) If you have any suggestions on how to resolve this issue, please help me out. function calcu ...

Using a combination of jQuery and AJAX to send data via a form

I've been working on a script to create a popup form that, once submitted, should trigger another function to send the data via ajax. However, I'm facing an issue where the second function isn't being activated. Can someone spot what's ...

Tips on retrieving unique data with id in Angular 6

My goal is to retrieve a particular customer's details by clicking on their ID or name. I have turned the name into a link that, when clicked, will navigate to a new page with the ID as a parameter so all the specific customer's information can b ...

Problem with Agile Carousel and thumbnail component

I have incorporated the Agile Carousel plugin into my website to create multiple slideshows. The first slideshow at the top is working fine, but I am experiencing an issue with the carousel in the "About" section at the bottom. While I have successfully se ...

Unable to trigger $(this).find("a").click(); with JQuery

I have a simple query that I believe the jQuery experts can help me with. I am attempting to implement a functionality for performing an action on gridview row double click, following the instructions on . I have managed to redirect to another page succes ...

Trigger the jQuery function based on the ID modification executed by jQuery

Is it possible to change the id of an HTML element using this function? $("#test").attr('id', 'test2'); Here is an example of the code: $("#test").click(function() { $("#test").attr('id', 'test2'); alert(& ...

Can a webpage be redirected to another page while passing along the id from the original page?

https://i.sstatic.net/3LhYJ.png I have a page that displays shop names and addresses along with an edit function in views.py: def update_shop(request, id): context = {} # * fetch the object related to passed id obj_shop = get_object_or_404(VideoL ...

Displaying a popup containing a div when clicking on a link

I need assistance with creating a link that will display a div in a popup window. Here is the link I am working with: <li><a class="newAttachmentType" onclick="getFiles(true)">Move to somewhere</a></li> Also, here is the div that ...

Tips for incorporating circumflex accent in an HTML textarea

I have a textarea in my HTML file where I need to use circumflex accents, allowing users to type characters like: ŝĝĉ However, when I try to type these characters, nothing happens. What could be causing this issue? I have already included: <meta ...

Can anyone assist me with form validation in JavaScript and jQuery?

There seems to be an issue with the query in this scenario. When I input a correct email address into the email box, it successfully validates it. However, if I then change the email box to be empty, it still displays the previously entered correct email ...

Executing javascript whenever a page is updated

Looking for a solution to ensure that my userscript runs every time an AJAX call modifies any page it is attached to. Is there a way to listen for XMLHttpRequests and trigger the script accordingly? ...

Using jQuery, modify the text of the accordion header without altering the icons

Utilizing the accordion feature provided by jQuery, I have incorporated some input fields within it. Let's assume the accordion consists of 3 expandable rows. If there is an error inputted into one of the fields, I want the header of that row to indic ...

How can I display different data values on each individual circle counter, rather than all circles showing the same data?

Hey there! I'm trying to get my circular counters to display the counter value that I specify in their class and data-percent. However, currently all four counters are only showing the data from the first counter, even though I've set different d ...

Javascript code for toggling the visibility of a div element not functioning as expected

This problem is becoming quite frustrating as it appears to be straightforward but still doesn't work. Inside my document, I have <div id ="splashscreen" style="display:block"> <h3>title</h3> <p>text</p> &l ...

Navigating through error messages in NextJs 14 can be tricky, especially when faced with the dreaded "ReferenceError: document not defined" or "prerendering error". It's vital to pinpoint exactly which page

When attempting to run the build on my Next.js application, I encountered an error message that is not very informative given the number of files/pages in my project. How can I pinpoint the exact location of this error and determine the root cause? The pro ...

After AJAX has been loaded, Readmore.js fails to function properly

I am currently struggling to get the Readmore.js plugin working with AJAX content. The code snippet I have included is not cutting off the content inside the .more element as expected. <td><div class="more"><?php echo $row['book_desc&a ...

The jQuery element selection feature is not functioning

Within my HTML file, there lies a table with an empty tbody that is dynamically filled by jQuery once the document is fully loaded. The content of the table body is generated using a PHP script, where jQuery fetches the data via a simple GET request. Belo ...

What is the proper way to apply :hover on the last child element using material-ui?

Currently, I am working with React and material-ui to create a menu component. This menu has a list of items, with the last item being unique in terms of styling. I have successfully used the :last-child selector for this purpose, but I am facing an issue ...

cURL windows fail to show the HTML response

Is there a method to prevent the html response from being shown in the console? It's causing a delay in my project and I want to deactivate it. I typically employ curl Appreciate it ...

Sending array data from the client-side JavaScript to the Spring MVC controller via AJAX

Is there a way to send an array from JavaScript in a web browser to a Spring MVC controller using AJAX? Here's the JavaScript code I have: var a = []; a[0] = 1; a[1] = 2; a[2] = 3; // Is it possible to send multiple arrays as well? $.ajax({ typ ...