Tips for displaying a gallery of 5 images in a 2-row slider using bxslider

I've been attempting to create a unique image slider using bxslider. My goal is to have a 2-row slider with 5 images displayed in each row. However, I'm encountering difficulties when I try to integrate the HTML, CSS, and JavaScript code.

Despite my efforts, I haven't been successful in positioning the slider on the left side of the page and aligning text on the right side. The slider is displaying all images in a single column rather than two rows as intended.

 $(document).ready(function(){
      $('.wraper').bxSlider({
        minSlides: 1,
        maxSlides: 5,
        mode: 'fade',
        adaptiveHeight: true
      });
    });

Answer №1

To display 5 slides in a single row, utilize the slideWidth and mode:'horizontal' in combination with minSlides and maxSlides. However, it is not possible to show 2 rows on a single slide as the plugin does not support it.

For showcasing a single row with 5 images at a time, refer to the code snippet below:

$(document).ready(function() {
  var slider = $('.slider').bxSlider({
    minSlides: 1,
    maxSlides: 5,
    mode: 'horizontal',
    adaptiveHeight: true,
    slideWidth: 100,
    moveSlides: 5,
  });
});
<link rel="stylesheet" href="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.min.js"></script>

<div class="slider">
  <div><img src="image1.jpg"></div>
  <div><img src="image2.jpg"></div>
  <div><img src="image3.jpg"></div>
  <div><img src="image4.jpg"></div>
  <div><img src="image5.jpg"></div>
  <div><img src="image6.jpg"></div>
  <div><img src="image7.jpg"></div>
</div>

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

JavaScript: Collecting data into an array of objects

Is there a more efficient way to fetch a specific object from an array of objects without using a for loop? Here is an example of the array of objects: 0: {code: "YJYDWO1", route_id: 1} 1: {code: "YJYDWO2", route_id: 2} 2: {code: "YJYDWO3", route_id: 3} 3 ...

The YoutubePlayer's OnStateChange event is not triggering as expected

Having trouble with the YouTube player OnStateChange event not firing. I've researched similar posts but none seem to match my unique situation since I'm using a different version (chromeless JavaScript). Here's the HTML: <div id="ytapi ...

Image caption dynamically updated to match thumbnail caption using jQuery upon click event

My goal is to dynamically load the data-caption of thumbnail images when clicked, and then update the main image's data-caption when the main image is changed with a thumb image. I am currently struggling to make the data-caption update along with the ...

Guide to utilizing jQuery for setting values in all subsequent rows of a table

I have a table with 15 rows of text boxes labeled as text1, text2, and so on up to text15. If I enter text into, let's say, the 5th textbox, I want that same text to be automatically copied into all subsequent textboxes from the 6th through the 15th. ...

Having trouble limiting the number of special characters in AngularJS

I am having trouble restricting special characters and spaces in the input text field. I tried using the following code snippet: ng-pattern="/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/" to prevent special characters, but it doesn't seem to be workin ...

Incorporated React component from Rails-assets.org into a Rails application

I have been trying to incorporate a react component from rails-assets.org into my Rails application. Currently, I am using the react-rails gem to write react view in my application. Now, I want to use other react components such as react-router, react-sel ...

Is there a way to ensure a notification bar only appears once during a user's session?

I am struggling to get my notification bar to display only once per session or for a set period of time. I have tried using session storage, but have not been able to make it work properly. Thank you! Below is the code I am working with: <script> ...

Nodejs image validation not working as expected

I'm currently working on a project using Nodejs and the expressjs framework. My goal is to allow image uploads through an API, but I have two specific requirements: 1) I need to implement validation for the dimensions (height and width) of the image. ...

How can I convert JSON data from an array to an array of objects using JavaScript?

My goal is to load data into an ag-grid. I have obtained the json data in the following format: {"my_data":{"labels":[1,2,3,...], "idx":["idx1", "idx2", ...]}} In order to pass it to the grid, I need to transform it to this format: {"my_data":[{"labels" ...

How to extract information for divs with specific attribute values using Jquery

I have multiple divs with IDs like #result-1, #result-2, each followed by a prefix number. To count the number of list items within these divs, I use the following code: $(document).ready(function () { var colorCount = $('#result-1 .item-result ...

What is the method for generating a popover in HTML when a user hovers over a button?

In this scenario, I have implemented two status buttons with different colors. The green button corresponds to "RUNNING" and the red button indicates "TERMINATED", which are fetched from JASON data. Upon hovering over the green status button, the text "RU ...

Displaying items in a row when the navbar is collapsed: Bootstrap 4 tips

Is there a way to change the display of items in the collapsed navbar so that they appear next to each other rather than in a column? You can see how it currently looks here: Navbar collapsed. My goal is to have the image displayed next to the username ins ...

Tips for creating a personalized event handling strategy in JavaScript

I find myself in the midst of designing and developing a web store, trying to figure out the best approach to handling the loading of a substantial amount of product items. It seems that although AJAX is asynchronous, it doesn't necessarily mean paral ...

jQuery uploadify encountered an error: Uncaught TypeError - It is unable to read the property 'queueData' as it is undefined

Once used seamlessly, but now facing a challenge: https://i.stack.imgur.com/YG7Xq.png All connections are aligned with the provided documentation $("#file_upload").uploadify({ 'method' : 'post', 'but ...

Why is Component scope not binding in AngularJS?

I encountered a problem and have set up a JSFiddle to showcase var myApp = angular.module("myApp", []); myApp.component("bar", { transclude: true, template: '<div ng-transclude></div>', controller: function ($scope, $elem ...

Remove an uploaded image utilizing an ajax uploader

I successfully implemented an AJAX loader for file uploads to the server. Everything is working well, but now I want to add a delete option for each image so that users can remove images before saving. The current layout of my images is as follows: To upl ...

Strategies for managing a large volume of pending requests

I am looking to create a website that can notify users about events happening on the server. Here is my proposed plan: Send an asynchronous request to the server (ASP.NET) with a 600-second time-out If an event occurs on the server within those 600 secon ...

What is Angular's approach to managing the @ symbol in view paths?

I found some interesting data lake sources on AWS. I came across their package.js file, which includes the following code: '@package': { templateUrl: 'package/package.html', controller: 'PackageCtrl' } I am curious a ...

Align Headers to the Top Center in React Material-UI Datagrid

Is there a way to align the wrapped headers at the top-center using sx? I've tried the following code: const datagridSx = { '& .MuiDataGrid-columnHeaders': { height: 'unset !important', maxHeight: '168p ...

String Replacement in JavaScript

Here's the scenario: I have a string var str="abc test test abc"; Is there a way to specifically replace the second occurrence of "abc" in the string using the str.replace() method? ...