Text Transition Effect Using JQuery Slider

I am currently implementing a JQuery slider on my website. While the slides themselves are working perfectly, I am facing an issue with the text below them. Whenever there is a gap between the slides (where there is no image), the text jumps up to the top of the page and then back down when the next slide is displayed. Is there a way to keep the text in place without it being affected by the slideshow?

    function startSlides(start, end, delay) {
        setTimeout(slideshow(start,start,end, delay), delay);
    }
    function slideshow(frame, start, end, delay) {
        return (function() {
        $('#slideshow' + frame).fadeOut();
        if (frame == end) { frame = start; } else { frame += 1; }
        setTimeout(function(){$('#slideshow' + frame ).fadeIn();}, 850);
        setTimeout(slideshow(frame, start, end, delay), delay + 850);
    })
    }
    // usage: startSlides(first frame, end frame, delay time);
    startSlides(1, 3, 5000);
.slideshow{
height:359px;
width:1000px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="slideshow">

<div id="slideshow1" class="slide">
<div><img src="http://wallpaperrich.com/wp-content/uploads/2014/09/3d-animated-frog-image.jpg" alt="Slide 1"></div>
</div>
<div id="slideshow2" class="slide" style="display: none">
<div><img src="http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2014/4/11/1397210130748/Spring-Lamb.-Image-shot-2-011.jpg" alt="Slide 1"></div>
</div>
<div id="slideshow3" class="slide" style="display: none">
<div><img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="Slide 1"></div>
</div>
</div>


<p>Bacon ipsum dolor amet tri-tip ribeye beef ribs chuck. Tail venison shank, cupim tongue pork loin beef ribs drumstick kevin ground round fatback. Boudin chicken andouille ham spare ribs fatback beef bresaola landjaeger frankfurter tongue. Hamburger fatback brisket flank. Pork loin kielbasa biltong tail pork chop pancetta bacon cow rump. Prosciutto pork loin cupim t-bone tongue shankle kielbasa, pastrami filet mignon ham jowl beef pork chop rump drumstick.</p>

Answer №1

Update CSS Style

.gallery

with

#gallery

You are adding CSS styles to a class called gallery, which does not exist in your HTML. This should be an ID instead.

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

A tutorial on utilizing fopen in PHP to write text lines to a .txt file

Struggling with PHP code utilizing fopen to write text lines into a textarea and save them to a .txt file. Below is the code I've been working on, hoping to get some assistance! <?php session_start(); if (!isset($_SESSION['username&ap ...

Error in JSON due to the presence of an unexpected token within the

I am facing a challenge with my PHP code, where I take a list of filenames or empty strings and store them in an array. This array is then converted to JSON and saved in a database successfully. However, the problem arises when this array is also stored wi ...

ESLint: The "react" plugin encountered a conflict

In my development environment, I have a React application within a single npm component package. This React app acts as a demonstration site that consumes the component package in addition to Storybook. local-component-package ├── .storybook ├─ ...

Retrieve all input elements starting with the name "myname" and loop through each of them using the Exit function

Having a strange issue while trying to exit the JavaScript code. This particular code involves an array of input elements. Whenever the "if" statement triggers and the script should return true or false, an unexpected alert('something') pops up ...

The PHP script is displaying all content following the echo statement

Currently in the process of constructing my inaugural website. Starting off by creating it on my laptop and will eventually upload it to my hosting service. The main focus of this website is to provide a searchable database containing information about fam ...

Reference to jQuery selectors for hyperlinks

I have added new links to a website I am working on for a friend. I tried using the jQuery snippet that works for the navigation bars, but it doesn't seem to be functioning properly. My assumption is that I might not be selecting the elements correctl ...

Is there a way to trigger an image flash by hovering over a button using the mouseover feature in AngularJS2?

When I hover over the 'click me' button, I want an image to appear on the webpage. When I stop hovering, the image should disappear using the mouseover option. This is what I attempted in my app.component.ts and my.component.ts files: Here is t ...

Get the whole webpage content (HTML, images, JS) using Selenium with Python

Is there a way to fully download the source code of a dynamically generated website like www.humkinar.pk in simple HTML form? I've attempted using the driver.page_source function from selenium, but it doesn't seem to capture everything, leaving o ...

What is the best way to increase the size of an image within a card and minimize the amount of white space

I have a card featuring an image, accompanied by a banner placed next to it. To structure this layout, I am using col-lg-8 for the card and col-lg-4 for the banner. However, I'm facing an issue with excessive white space between the card (which has a ...

What is the best way to manage a group of checkboxes using EJS?

I am currently utilizing ejs for my website pages and on one particular page, I have an array of objects. The number of objects in the array is not known when the page initially loads. This page allows me to edit a series of announcements and I would like ...

What is the most effective way to line up three square images, with one being larger than the other two, and positioning the larger one to the left of the two smaller ones stacked on top of each other?

Currently, I am struggling with arranging three square images on a webpage. The larger image should measure 800 x 800 pixels and be positioned to the left, while the two smaller images, each measuring 400 x 400 pixels, should stack vertically to the right ...

Can the HTML title attribute be customized?

<h2 title="Site Owner">Mr. Mark </h2> Is there a way to customize the HTML title attribute using CSS, as shown in the example above? I attempted to apply inline CSS to it, but it didn't have any effect. ...

Is it possible to convert checkbox values from a form into a JSON format?

HTML snippet : <form class="form-horizontal" id="addpersons" style="padding:20px;"> <fieldset class="scheduler-border"> <!-- Form Title --> <legend class="scheduler-border">Information</legend> <!-- First Name input-- ...

Extract the content within an HTML element that is not within a header tag

Is there a way to extract the inner text from HTML using HTMLAgilityPack in C#, excluding text within any <h1-6> tags? I prefer not to use Regular Expressions and stick to HTMLAgilityPack. This is my current approach: var document = new HtmlDocumen ...

Is it possible to have background animation within an irregularly shaped Canvas or SVG?

I am looking to create a unique and dynamic, animated background using either JavaScript or CSS for a non-rectangular shape in Canvas or SVG. Check out this example animation: https://codepen.io/tmrDevelops/pen/NPMGjE Here's the shape along with my ...

"Encountering a Null Value when Using HtmlGenericControl

I'm facing an issue and need some assistance. I am attempting to change the "display:none" property to "display:block" in my div tag within the Content Page. However, when I use the code below, the HtmlGenericControl class keeps throwing an error stat ...

Issues with AngularJS html5Mode refreshing

Here is the setup of my router using AngularJS: var app = angular.module('tradePlace', ['ngRoute', 'tradeCntrls']); app.config(['$routeProvider', '$locationProvider', function($route, $location) { $rou ...

Issues with POST data not being received by MVC 4 APIController

Although this issue has been addressed numerous times, I am still unable to pinpoint the error! Here is a straightforward JS script that sends data back to the ApiController. function WebCall(url,parameterObject, callBackFunction) { this.callbackfunction ...

Getting the Correct Nested Type in TypeScript Conditional Types for Iterables

In my quest to create a type called GoodNestedIterableType, I aim to transform something from Iterable<Iterable<A>> to just A. To illustrate, let's consider the following code snippet: const arr = [ [1, 2, 3], [4, 5, 6], ] type GoodN ...

Sending data using an Ajax POST request to an external website

Here is a basic post function (see below) $("#abi_test").click(function (event) { $.post( "get.php", { name: "Tom", age: "30", email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" d ...