Incorporating descriptions below the images within this JavaScript carousel

I'm struggling to add text under the images in this slider. The functionality is simple, but I can't figure it out. I might have to rewrite it. Here's the HTML and JS:

<div id="look-book-scroll">
  <a href="javascript:;" id="lookbook-left-advance"></a>
  <div id="lookbook-wrapper">
    <div class="lookbook-image">
      <%= image_tag(asset_path("img/page1.jpg")) %>
       <div class="lookbook-bl">
        <p>Hi Gus!</p>
      </div>
    </div>

    <div class="lookbook-image">
      <%= image_tag(asset_path("img/page2.jpg") ) %>
    </div>

    <div class="lookbook-image">
      <%= image_tag(asset_path("img/page3.jpg")) %>
    </div>

  </div>
  <a href="javascript:;" id="lookbook-right-advance"></a>
</div>

JS:

 // LookBook Right Click
$("#lookbook-right-advance").click(function(){
    if(lookbook_image_scrolling == false){
        lookbook_image_scrolling = true;
        if(parseInt($("#lookbook-wrapper .lookbook-image:first").css('left')) == -890){
            $("#lookbook-wrapper .lookbook-image:first").remove().insertAfter("#lookbook-wrapper .lookbook-image:last");
            $("#lookbook-wrapper .lookbook-image:last").css('left', ((lookbook_image_num - 1) * 890)+'px');
        }
        $("#lookbook-wrapper .lookbook-image").each(function(){
            $(this).animate({
                left: '-=890px'
            }, 1000, function(){
                lookbook_image_scrolling = false;
            });
        });
    }
});    

Also, including the CSS that may be causing the issue:

#lookbook-wrapper{
position: relative;
height: 590px;
width: 830px;
overflow: hidden;
img {
    width: 100%;
    height: 100%;
}
}

#lookbook-wrapper .lookbook-image {
    position:absolute;
    top: 0;
    z-index: 1;
    width: 830px;
}

#lookbook-wrapper .lookbook-image:first-of-type {
    z-index: 2;
}

#lookbook-left-advance {
    left: -39px;
    cursor: w-resize !important;
    @include store-sprite(lookbook_left_button);
}

The left-advance function is the same as the right one so just focus on fixing the right. Any suggestions would be greatly appreciated!

Answer №1

To enhance the layout of your .lookback-image sections, consider inserting a block-level element below the image and surrounding the text with a block-level element like <p> or <div>. Given that your current positioning code seems to focus on the containers rather than the images themselves, there should be no issue with the text appearing below the images.

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

Jasmine spies call through problem detected

I can't seem to get my code to work properly and I keep encountering this error: TypeError: undefined is not an object (evaluating 'GitUser.GetGitUser('test').then') ... Check out the code snippets below: app.controller(&apo ...

"Enhance your forms with Ajax for seamless uploading and convenient text

My current challenge involves submitting a form that features multiple file uploads using ajax along with text input. I'm facing an issue where if a user successfully uploads all the files using ajax but forgets to enter their name, the form resets an ...

What is the best way to use an object as a key to filter an array of objects in JavaScript?

My data consists of an array of objects: let allData = [ {title:"Adams",age:24,gender:"male"}, {title:"Baker",age:24,gender:"female"}, {title:"Clark",age:23,gender:"male"}, {title:"Da ...

Issue with react-router-dom: <Route> elements are strictly meant for configuring the router and should not be rendered on their own

I've been grappling with this issue for quite some time now, but none of my attempts have succeeded and I keep encountering the same error: < Route> elements are for router configuration only and should not be rendered Here's the snippet ...

Mapping variables to attributes in polymers

I'm working with a polymer element that looks like this: <polymer-element name="foo" attributes="bar"> <template> <core-ajax url="url.php" params="{{ {last: bar} }}"></core-ajax> {{bar}} </template> </polymer-element& ...

Step-by-step guide on using variables to apply CSS

In our table consisting of 6 rows and 2 columns, the second column displays a Font Awesome circle followed by various values in the database field (such as Outstanding, Very Good, Good, Needs Improvement, and Adequate). I am looking to dynamically change ...

Changing the color of a pseudo element in Material-UI

I'm having trouble changing the border color of the ::after pseudo element on a standard text field from MUI. I've been unable to figure it out. <TextField id="standard-basic" label="Email" variant="standard"/> ...

various stunning galleries accessible from a single page of thumbnail images

I'm trying to create a unique gallery experience on my website. I have a set of 6 images, each featuring a different house. What I want is for each image, when clicked, to open up a fancybox gallery showcasing 4 more detailed photos of the same house. ...

How can you modify information while utilizing a personalized data retrieval React Hook?

I've been working on creating a chart using data retrieved from an API that provides information in the following format: { "totalAmount": 230, "reportDate": "2020-03-05" }, { "totalAmount": 310, "reportDate": "2020-03-06" } ... When display ...

Two divs positioned on the left side and one div positioned on the right side

Hey there, I am attempting to align 2 divs on the left side with one div on the right. #div1 #div2 #div1 #div2 #div3 #div2 #div3 #div3 The challenge is to have #div2 positioned between #div1 and #div3 when the browser window is resized smaller. Currentl ...

Using `window.location.href` will terminate any pending asynchronous calls to the API

Before all async calls to the API are completed, window.location.href is triggered when the code runs. Setting a breakpoint on the location resolves the issue. How can I ensure that all calls are finished before invoking window.location.href? Code: const ...

Storing progress of a multi-step form in Laravel 5.6 on both the database and local drive

I've been working on implementing a multi-step form using JQuery Steps in Laravel 5.6. Instead of just saving all the data at the end, I want to save each step of the form in the MySQL database and on the user's local drive. This way, I can track ...

NextJS displays outcomes as per query parameters obtained from an external API

I have set up my NextJS app to connect to a rest API. The API returns results based on different filters in the query string, such as: /jobs /jobs?filter=completed /jobs?filter=upcoming /jobs?filter=cancelled On my NextJS page, I have a few buttons that I ...

Tips for retrieving data from an Excel spreadsheet on an HTML/CSS webpage

I have a single HTML template at this location: . The current page is tailored for the state of Arkansas in the US, but I now need to replicate the design for all 50 states. Each state page will have the same layout, but different content specific to that ...

Middleware that is commonly used by both error handling and regular request-response chains

I am currently working on implementing a middleware that can set a variable in the sequence of both error and non-error scenarios. Is there a way to achieve this without disrupting the normal flow of middleware? Specifically, when I include the err param ...

ng-select search functionality failing to display any matches

Currently, I am encountering an issue with the ng-select functionality in my Angular CLI version 11.2.8 project. Despite using ng-select version 7.3 and ensuring compatibility with the Angular CLI version, the search functionality within the select eleme ...

Tips for retrieving javascript-generated HTML content

Currently, I'm attempting to retrieve article headlines from the NY Times website. Upon inspection, it appears that the HTML is being generated by Javascript since it's only visible when using the 'inspect element' feature in Firefox. ...

There are two distinct varieties of object arrays

I recently encountered an issue while trying to sort my array of Star Wars episodes by episode ID. The problem emerged when comparing two arrays: one manually inputted in the code snippet labeled as "1" on the screenshot, and the other generated dynamicall ...

Weird occurrences observed when JSON wraps my objects

I am sending the following request to my server: $.ajax({ url: url, data: JSON.stringify({ SecretKey: e.Code, CommentId: e.Id, Direction: direction, VoteType:1}), type: "POST", contentType: "application/json;charset=utf-8", }); After the ...

"Exploring the incredible powers of Ionic2, Angular2, HTTP requests, and

Despite all the research I've done on observables, I still struggle to grasp how they function. The HTTP request code snippet is as follows: import { Component, OnInit, Injectable } from '@angular/core'; import { Http, Response, Headers, R ...