What are some ways to display a slider along with a caption?

Using JQuery

$('.slider').cycle({
    fx: 'scrollHorz',
    slides: '>a',
    swipe: true,
    easing: 'easeInOutExpo',
    prev:'.btn_prev',
    next:'.btn_next',
    timeout: 5000,
    speed: 1000,
});

Here is the HTML structure:

<div class="slider">
    
      <a class="cycle-slide">
          <img src="slide07.jpg">
          <div class="caption">
              skdfksfksdfksdhfvdkvdk
          </div>
      </a>
  
  
      <a class="cycle-slide">
          <img src="slide07.jpg">
          <div class="caption">
              skdfksfksdfksdhfvdkvdk
          </div>
      </a>
  
      <a class="cycle-slide">
          <img src="slide07.jpg">
  
          <div class="caption">
              skdfksfksdfksdhfvdkvdk
          </div>
      </a>
  
  </div>

This is the CSS style for the caption:

.caption {
      position: absolute;
      top: 0;
      right: 0;
      background: #000;
      opacity: 0.7;
      height: 100%
      width: 300px;
  }

Despite following the correct syntax, the caption does not appear as intended on the right side of the image. I have struggled to troubleshoot this issue and cannot figure out why it's not working.

I noticed that a demo on the Cycle website shows captions by using the "alt" attribute and placing them at the bottom. I am perplexed as to why my captions are not displaying on the right side.

Update: Issue with arrows - next and prev buttons

 <a href="#" class="btn_prev"></a>
            <a href="#" class="btn_next"></a>

How can I ensure that these arrow buttons remain aligned with the caption area of each slide so they move together during transitions?

Answer №1

According to the caption demonstration

To create a default caption in your slideshow, simply include an empty div with the cycle-caption class in the container.

The correct class to use is cycle-caption, not caption as mentioned in the instructions.

Answer №2

Take a look at the following CSS styling:

CSS

.description {
position: relative;
top: 0;
right: 0;
color:#fff;
background: #000;
opacity: 0.7;
height: 100%
width: 300px;
display:block;
text-align:right;
}

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

Automatically execute a function every 5 seconds in Angular application

I have a component in Angular that is responsible for fetching data from the backend. Below is the code snippet of the component export class MessagesComponent implements OnInit { constructor(private _router: Router, private http: HttpClient) { } t ...

Tips for showcasing retrieved JSON with jQuery's ajax functionality

Below is the jquery code I am working with: $.ajax({ type: "POST", url: "Ajax/getTableRecord", data:{ i : id, t: 'mylist'}, dataType: 'json', success: function(data){ alert(data); ...

Convert a single object into a JSON string representation on each line

Can you convert the following data into the desired format through stringification? Data: let result = JSON.stringify([ { "Color": "Red", "Type":"Fast" }, { "Color": "Blue&quo ...

Problem with pixel alignment due to decimal placement

Recently, a helpful member of the StackOverflow community provided me with some jQuery-based Javascript code. The code works well overall, but there is a persistent issue that I need assistance with. Specifically, the JavaScript calculates a margin for a ...

What are some ways to establish a connection with the store in components that are not using React

It's been a struggle trying to connect to the store using non-react components. Whenever I attempt to use getState or dispatch in a non-react class like this: createStoreWithApi(api).dispatch(isLoading(true)), it ends up creating a new instance of the ...

Importing a .js file into HTML with AJAX

The following JavaScript code is located within index.html between "<script type="text/javascript">" function callanular() { peticion_http = new XMLHttpRequest(); peticion_http.onreadystatechange = showContent; peticion_ht ...

Tips for aligning my icon in the middle when I collapse my sidebar

Seeking assistance on centering the hamburger icon on my sidebar. Currently, when I adjust the width of the sidebar, the icon is not centered at all. Does anyone have a solution for achieving this? I attempted using justify-content: center in the main clas ...

Activate an update of a jQuery color selector plugin when there is a change in the input field

Currently, I am utilizing the jQuery .click() method to update 15 text fields with basic color hex values like this: document.form1.top_menu_bgcolor.value = '#FFFFFF'; In addition, I have incorporated ExColor for jQuery from which showcases an ...

Ensure that the video is properly positioned within the background when utilizing the background-size cover property

I am currently working on a project that requires me to position a video clip on a specific section of the background image, ensuring that the video always appears on top of the phone's screen. The responsive background image is constantly changing. H ...

How do you switch selection to "hold" mode using Javascript?

In my Markdown preview area, clicking on text will cause the preview area to switch to a markdown source editor automatically, with the cursor jumping to the position corresponding to where it was clicked. function onMouseDown(e) { const range = documen ...

A curious phenomenon observed in the behavior of the jQuery offset() method

Once I executed the following code snippet multiple times: $view.offset({ left : X, //X remains constant top : this.y }); console.log($view.offset()); //displays expected output I noticed (using Firebug) that the HTML code looked like this: <di ...

Troubleshooting Datatables and Laravel 4: Issues with Table Rendering and Ajax Error

Last night and today, I've been struggling with a Laravel 4.2 project that involves handling large tables with over 2000 records for some users. My goal is to utilize ajax functionality to retrieve data dynamically. Despite trying the PHP example from ...

How to initiate a countdown timer on a server and execute an event once the timer reaches zero

I am currently working on a website that will host contests. When a moderator starts a test, a countdown timer will begin. Once the countdown finishes, an "Exam" event will launch. After the test time elapses, the page will automatically refresh to displ ...

Guide on uploading images to a NodeJS server from an Angular 2+ application

I have a NodeJS rest-API that can handle both images and text content in the same function. Currently, I am using multer in my NodeJS server to manage image uploads along with text content. Below is an example code snippet showcasing how I am handling this ...

Foundation and equalizer do not provide an optimal user experience

I am new to using Foundation. Currently, I am utilizing Foundation 5 along with equalizer. I have a row with 2 columns - one containing text and the other containing an image. I want both columns to have the same height, so I am using data-equalizer. ...

Using AngularJS to dynamically update an array of objects in response to a selection change

I am facing a challenge with two dynamic object arrays: one for colors and one for buses. The main objective is to assign a color to each bus. I have used ng-repeat to create selects for each color, and employed ng-change to call the updatebus function, pa ...

Updating the property value of an element in Angular 9

I'm facing an issue where I can't change the attribute value of an element successfully. Is there a best practice in Angular that can help solve this problem? <div name="hai" (click)=test($event) #ckechName> In the TypeScript ...

Uniform image dimensions across varying columns

I have a layout with 4 columns, each containing an image and text. The images in each column have different heights and widths, while the text lengths also vary. I want all the images to be the same height and width proportionate to the image itself. Addit ...

Encountering a problem when making a HTTPS GET request to a REST API using

I am currently running an Angular application that utilizes an external API to fetch country ISOs. However, I am encountering an error with the API since it uses HTTPS. Interestingly, when I implement a proxy in my Angular local environment by mapping /is ...

Creating a connection between socket.io-client and react: A step-by-step guide

I am facing an issue with integrating socket.io-client with a React application. Despite having both the React app and the server running, I am unable to display a message in the console when a connection is established. server.js const app = require(&apo ...