Unable to use saved images with jQuery Slider

I'm currently facing an issue with adding a jQuery slider to my website. It seems that the slider is not displaying images that are saved on my computer, only images from external websites.

Below is the code snippet where I have included an image file path for reference:

<!DOCTYPE HTML>
<html>
    <head>
        <title>UnSlider</title>
        <style>
            body, html {
                padding:0px;
                margin: 0px;
            }
            .banner { 
                position: relative; 
                width: 100% !important; 
                overflow: auto; 
                padding: 0px;
                margin: 0px;
            }
            .banner ul {
                padding: 0px;
                margin: 0px;
            }
            .banner li { 
                list-style: none; 
                padding: 0px;
                margin: 0px;
            }
            .banner ul li { 
                float:left;
                padding: 0px;
                margin: 0px;
                min-height: 350px;
                -webkit-background-size: 100% auto;
                -moz-background-size: 100% auto;
                -o-background-size: 100% auto;
                -ms-background-size: 100% auto;
                background-size: 100% auto;
                background-position-y: -75px;
                box-shadow: inset 0 -3px 6px rgba(0,0,0,.1);
            }
        </style>
    </head>
    <body>
        <div class="banner">
            <ul>
                <li style="background-image: url("../images/jam.jpg");"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
                <li style="background-image: url('http://placehold.it/1400x400');"></li>
            </ul>
        </div>

        <script src="http://code.jquery.com/jquery-latest.min.js"></script>
        <script src="http://unslider.com/unslider.min.js"></script>

        <script>
            $(document).ready(function(){
                $('.banner').unslider({
                    speed: 500,               //  The speed to animate each slide (in milliseconds)
                    delay: 5000,              //  The delay between slide animations (in milliseconds)
                    keys: true,               //  Enable keyboard (left, right) arrow shortcuts
                    dots: false,               //  Display dot navigation
                    fluid: false              //  Support responsive design. May break non-responsive designs
                });
            });
        </script>
    </body>
</html>

Thank you!

Answer №1

Perhaps, it would be beneficial if you could provide the directory path to where your html file is located and the folder containing the images.

For example, if your html file is situated in: /Users/Dom/Desktop/NewWebsite, to link to an image, you can use:

<li style="background-image: url("images/jam.jpg");"></li>
or
<li style="background-image: url("images/jam.jpg");"></li>
as shown in your scenario. Using two dots(..) denotes moving one folder up, if the image is within the same folder. Alternatively, you can also try:
<li style="background-image: url("./images/jam.jpg");"></li>
One dot(.) indicates there is a folder named images within the current directory, navigate inside it to locate a picture named jam.jpg. I hope this explanation proves helpful. Best of luck! –

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

What could be causing the target to malfunction in this situation?

Initially, I create an index page with frames named after popular websites such as NASA, Google, YouTube, etc. Then, on the search page, <input id="main_category_lan1" value="test" /> <a href="javascript:void(0)" onmouseover=" window.open ...

The cross-domain AJAX request fails to receive a response

I am currently working on validating PAN card details. I am utilizing an AJAX call to verify the PAN card entered by the user, sending the PAN number to this URL: . The data is being sent to the following URL using AJAX call: function callbackFnc(data) { ...

"Utilize PHP and jQuery to seamlessly add new records and images to your

Below is the jquery code I am using: $.post('action/edit_breakdown.php', {id: id,program: program,st_name: st_name,p_name: p_name,fob_name: fob_name,track_no: track_no,date: date,currency: currency,image_name: image_name}, function(data){ ...

Does Less undergo a compilation process in a single pass?

Does Less execute a single pass on the files, or does it perform multiple passes? I am particularly worried about what will happen if I include another file that redefines variables and mixins. Will the generated output use the original values, or will it ...

Ensure images are correctly aligned

Could really use some help with this issue I'm having. It's probably a simple fix for all you experts out there, but I can't seem to align my images properly so they are even and not one higher than the other. Please take a look at the scree ...

Arranging based on attribute data

I'm currently working on organizing a collection of divs that have unique custom data attributes which I aim to sort based on user selection. For instance, if 'followers' is chosen, the .box elements will be arranged according to their data- ...

Bringing in CSS variables to a Typescript document

In order to streamline the styling process for our app, we have established a theme.css :root file containing a set of commonly used variables that can be accessed across all other .css files. However, some of our older code follows a similar structure bu ...

Is it possible for a jQuery ajaxSuccess function to detect an AJAX event in a separate JavaScript file? If it is, what steps am I missing?

I've been attempting to initiate a function following an ajax event. I have been informed that despite the ajax event occurring in a different file (on the same server, if that makes a difference) and that the file is javascript, not jquery, "Ajaxsucc ...

Applying binary information to an image

Let's say I have an <img/>. The img is initially set with src='http://somelocation/getmypic'. Later on, there might be a need to change the content of the image based on some ajax call that returns binary data. However, this decision c ...

Easily validating forms using javascript

I'm attempting to design a basic HTML form and would like to implement javascript for validating the input values. Below is the form tag: <form action="" onSubmit="return formValidation();" method="Post" name="form"> Here is a section of the ...

Troubleshooting: The Jquery each loop is malfunctioning

I am new to using jquery and I have encountered a problem in my project. I am attempting to iterate through all the links within the #rate_box and attach a click event to them. This click event is supposed to send data to an external php script, then remov ...

A slender gap of white space delicately separates the transformed parent from its offspring

When trying to align a parent div with a child div that has the same background-color as the parent's border-color, I am encountering an issue. Despite my efforts, there seems to be a thin line of whitespace separating the two divs. It is worth notin ...

The code, which is the same, placed in a different location on another page - fails to function

On the index.php page, I have successfully implemented the following code snippet at the bottom: <script type='text/javascript'> $("#tbAlegro").click(function() { window.location = 'alegro.php'; }); </script> However, ...

Receiving NaN in javascript when attempting to calculate the sum using a text input field

I am trying to calculate the total value by adding a fixed price with another value entered in a text input field. Here is the HTML code snippet: <%= f.text_field :hoursclass, id:"txt_hours" %> And here is the JS code snippet: $(function() { va ...

How to implement PayPal integration in PHP

I am currently working on integrating the paypal payment system into a website dedicated to pet adoption. Initially, I had a basic code structure that was functional. However, after making some modifications and additions to the code, it no longer redirect ...

The crash during compilation is triggered by the presence of react-table/react-table.css in the code

My code and tests are functioning properly, but I am facing a challenge with my react-table file. The react-table.js API specifies that in order to use their CSS file, I need to include import "react-table/react-table.css"; in my react-table.js file. Howev ...

Simulating the behavior of display blocks

HTML similar to the example below is working perfectly, however, there seems to be an issue with Sharepoint 2013's editor. When trying to edit the link text within a block that has 'display: block' or 'float', it becomes impossible ...

Step-by-step guide on resolving the issue of an ajax form redirecting to a mailer

I have been working on implementing the contact form on an HTML page. The validation was functioning correctly until I added it, and now the form is no longer submitting properly. Despite this issue, the page still redirects to mailer.php. The AJAX functio ...

Guide on implementing a progress bar for file uploads with JavaScript and AJAX request

I am looking to implement a progress bar in my file uploader. Below is the ajax call I have set up for both file upload and progress tracking. $(function() { $('button[type=button]').click(function(e) { e.preventDefault(); ...

Loading an empty CSS file in Node.js

Just starting out with node.js, and I could really use some help with a small css and image issue that I'm facing. I've streamlined my html and .js for clarity. Despite trying everything, the css and image just won't load. My form and server ...