Struggling to figure out why BXSlider won't cooperate

I'm struggling to make BXSlider work on my website.

Here is the code I have used. The JS/CSS files are properly linked and downloaded from the site with correct paths.


$(document).ready(function(){
  $(document).ready(function(){
    $('.bxslider').bxSlider();
  });
});

<!-- jQuery library (served from Google) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<!-- bxSlider Javascript file -->
<script src="../js/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="../js/lib/jquery.bxslider.css" rel="stylesheet" />
<script src="../js/script.js"></script>

<ul class="bxslider">
<li><img src="../Images/Welcome/0008.jpg" /></li>
<li><img src="../Images/Welcome/0025.jpg" /></li>
<li><img src="../Images/Welcome/IMG_0061.jpg" /></li>
</ul>

Answer №1

Make sure to check if the path for the JS and CSS files is correct. Also, ensure that you follow the correct order of code execution.
1. Begin with including the necessary files for initialization.
2. Add the HTML code.
3. Implement the controller/script for any modifications or targeting.

Check out the sample code below:

Within the < head > tag

<!-- jQuery library (served from Google) -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<!-- bxSlider Javascript file -->
<script src="/js/jquery.bxslider.min.js"></script>
<!-- bxSlider CSS file -->
<link href="/lib/jquery.bxslider.css" rel="stylesheet" />


Within the < body > tag

<ul class="bxslider">
<li><img src="/images/pic1.jpg" /></li>
<li><img src="/images/pic2.jpg" /></li>
<li><img src="/images/pic3.jpg" /></li>
<li><img src="/images/pic4.jpg" /></li>
</ul>


Prior to the closing < /body > tag

<script>
$(document).ready(function(){
 $('.bxslider').bxSlider();
});
</script>

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

File Upload yields a result of 'undefined'

Currently, I am utilizing Express File Upload. When attempting to send a post request to it, the error-handler returns an error indicating that no files were found. Upon logging console.log(req.files), it shows as undefined, causing the error to be sent ba ...

The combination of AddEventListener in the parent and postMessage in the iframe is ineffective

As I delve into the Stripe documentation to develop a new feature, I have encountered an issue regarding the communication between a webpage and an iframe. The code in index.html: <!DOCTYPE html> <body> parent<br> <iframe src="./ ...

What could be causing variations in the performance of my Speech Recognition code each time I run it?

Check out my code snippet: export class voiceRecognition { constructor() { } public startVoiceRecognition() { const recognition = new webkitSpeechRecognition(); recognition.continuous = false; recognition.interimresults = false; recogn ...

"Create a table from a multidimensional array and showcase it using jQuery: A step-by-step guide

I have successfully returned a multidimensional array from a PHP script to an HTML page via AJAX. The values are correctly returned in the array, confirmed by checking the console.log. Now my question is, how can I treat each array as an individual array ...

What is the method for inserting a line break into a string that is being transferred to a component in Next JS?

I am currently collaborating on a group project that involves developing a website. One of my team members created a ContentBlock component to facilitate the creation of new pages (see component code below). I have been working on a new page for the site a ...

Create an array populated with unclosed HTML tags that need to be rendered

I'm trying to display a simple list, but it seems like React is having trouble rendering unclosed HTML elements that are pushed onto the list. This results in an error: ReferenceError: el is not defined If I use single quotes (') bookingStat ...

Expand or collapse in a sequential manner

Is there a way to ensure that only one table row expands at a time, causing the others to collapse? Any suggestions on achieving this? Here's the HTML code snippet: <table class="table"> <tbody> <tr class="parent" id="2479"> ...

Tips for maintaining consistency in the design of grouped jQuery buttons

When using jquery-1.9.1.js and jquery-ui-1.10.2.js, I create three separate buttons as shown below: <button id="bt1">bt1</button> <button id="bt2">bt2</button> <button id="bt3">bt3</button> These buttons have nice rou ...

Having Difficulty Formatting HTML Input in Next.js

I'm encountering difficulties when trying to style HTML form elements in Next.js. I've been unsuccessful in applying CSS using a simple class name from the imported stylesheet, but have managed to achieve some success with inline styling by using ...

Easy ways to align sprite images and text in the center

I am trying to utilize css sprites for my website. I have a basic image and some text that I would like to display together. My goal is to center the image on the page, and then vertically center the text next to it. As a newcomer to css, I am struggling t ...

Strings holding special arrangements of breaks in between

Currently, I am developing a portal that enables examiners to provide a problem statement, sample input, and sample output. However, I am facing an issue where the sample input/output values are stored as complete strings, causing line breaks to not render ...

Implementing coordinate formatting in JavaScript [Node.js]

I'm looking to tweak the JSON output into this specific format: [ 50.87758, 5.78092 ], [ 52.87758, 5.48091 ] and so on. Currently, the output looks like this: [ { lat: 53.1799, lon: 6.98565 }, { lat: 52.02554, lon: 5.82181 }, { lat: 51.87335, l ...

The performance of the animation on http://responsive-nav.com/ becomes erratic when viewed on Android devices

Recently, I came across a fantastic plugin that works perfectly on regular computer browsers. However, when I tested it on my android phone, the css3 animation for the dropdown appeared choppy and seemed to be dropping frames. Does anyone have suggestions ...

Tips for adding an element based on a CSS attribute's value

Is there a way to dynamically adjust the CSS for an element with opacity less than 0? How can I conditionally hide this element if that scenario occurs? if ($('#rounded_items li').css("opacity") < "0"){ $(this).css('display',&ap ...

In what scenarios would implementing the JS Switch case statement be more efficient than using numerous If/Else statements?

Greetings and thank you in advance for any help or guidance. I am currently developing a Space Battle game and I am curious to know if there is a way to utilize a JavaScript SWITCH case statement to streamline the numerous If/Else statements that are curr ...

Having trouble retrieving the post ID in WordPress

I am facing an issue with the post id not displaying correctly. Within my jQuery script, when the post id is 1234 it appears as postid:1290. Below is the code snippet calling my action in jQuery. $("#vote").not(".disabled").click(function() { var el ...

Angular directive does not focus on the text box

I've been working on creating text boxes using a directive and I want only the first text box to be in focus. To achieve this, I am utilizing another directive for focus control. Below is my script: <script> angular.module('MyApp',[]) ...

PHP and AJAX combine to dynamically update a MySQL database

After recently embarking on a web project, I encountered some issues with updating a MySQL query through AJAX and PHP. My server uses PHP 5.2*, and whenever I click the button to update the database, sometimes nothing happens, while other times I receive ...

A hyperlink unveils a visual and conceals its own presence

I'm a beginner in the world of coding and I have a question about creating a link that reveals a hidden image while hiding itself using HTML. After some research, this is what I've come up with: <a href="javascript: ...

A guide to obtaining radar chart coordinates by utilizing the getValueForDistanceFromCenter method in Chart.js

I've been experimenting with creating radar charts using Chart.js. I have a good grasp on the basics, as shown in the simple chart below, but I'm looking to utilize the x y coordinates of the graph to position text directly on the canvas. After ...