Feeling trapped during the process of setting up a intricate jQuery Image Slider

I've hit a roadblock while trying to make changes to the slider located at THIS URL.

In the current setup, each thumbnail corresponds to one main display image. Clicking on a thumbnail displays a single image and then proceeds to slide to the next thumbnail along with its associated image in sequence.

However, I now aim to tweak this slider so that one thumbnail can be linked to multiple images - essentially establishing a one-to-many relationship (one thumbnail to several main display images).

For example, upon clicking on the "Bedroom thumbnail" (as depicted in the attached SCREENSHOT), it should exclusively showcase and slide through 5 or more images related to that specific thumbnail. The same principle applies to other thumbnails like "Bathroom," where clicking would reveal a series of images tied to that category.

The HTML code for my modified Thumbnail Section remains unchanged.

I have made adjustments within the Main Image section as follows...

<div id="lofslidecontent45" class="lof-slidecontent" style="width:670px;height:236px;">
<div class="preload"><div></div></div>
<div class="lof-main-outer" style="width:670px; height:236px;">
<ul class="lof-main-wapper">
    <li>
        <ul class=”lof-main-subwapper”>
                    <li>
 <img src="images/slider1.jpg" title="Newsflash 2" >           
                        <div class="lof-main-item-desc">
                        <h3>Innovation</h3>
<h2>lorem ipsum is simply dummy text</h2>
                        </div>
                    </li>
                     <li>
                         ..
                     </li>
         </ul>
     </li>
     <li>
        <ul class=”lof-main-subwapper”>
            <li>
                …
            </li>
            <li>
                …
            </li>
        </ul>
    </li>
</ul>
</div>
</div>

In the process of tweaking the slider's script code, I have introduced another 'wrappersub' class but face difficulty connecting a group of images to a single thumbnail - linking the ul of the main image section with the li elements from the thumbnail...

(function($) {
 $.fn.lofJSidernews = function( settings ) {
    return this.each(function() {
        // obtain an instance of the lofSiderNew.
        new  $.lofSidernews( this, settings ); 
    });
 }


$.lofSidernews = function( obj, settings ){
    this.settings = {
        direction           : '',
        mainItemSelector        : 'li',
                    mainInnerItemSelector   : 'li',
        navInnerSelector    : 'ul',
        navSelector         : 'li' ,
        navigatorEvent      : 'click',
                    subWrapperSelector      :'.lof-main-subwrapper',
        wapperSelector:     '.lof-main-wapper',
        interval        : 4000,
                    innerinterval           :20000,  
        auto                : true, // toggle automatic play of the slideshow
maxItemDisplay      : 5,
        startItem           : 0,
        navPosition         : 'vertical', 
        navigatorHeight     : 100,
        navigatorWidth      : 310,
        duration            : 600,
navItemsSelector    : '.lof-navigator li',
        navOuterSelector    : '.lof-navigator-outer' ,
        isPreloaded         : true,
        easing              : 'easeInOutQuad'
    }   

$.extend( this.settings, settings ||{} );   
    this.nextNo         = null;
    this.previousNo     = null;
    this.maxWidth  = this.settings.mainWidth || 600;
    this.wrapper = $( obj ).find( this.settings.wapperSelector );
            this.subSlides = this.wrapper.find( this.settings.mainItemSelector );
            this.subwrapper = this.subslides.find(this.settings.subWrapperSelector)
            this.slides = this.subwrapper.find(this.settings.mainInnerItemSelector)

if( !this.wrapper.length || !this.subslides.length ) return ;
if( !this.subwrapper.length || !this.slides.length ) return ;
if( this.settings.maxItemDisplay > this.slides.length ){
        this.settings.maxItemDisplay = this.slides.length;  
}
    this.currentNo      = isNaN(this.settings.startItem) )
|| this.settings.startItem > this.slides.length ? 0 : this.settings.startItem;
this.navigatorOuter = $( obj ).find( this.settings.navOuterSelector );  
    this.navigatorItems = $( obj ).find( this.settings.navItemsSelector );
this.navigatorInner = this.navigatorOuter.find( this.settings.navInnerSelector );
if( this.settings.navPosition == 'horizontal' ) { 
        this.navigatorInner.width( this.slides.length * this.settings.navigatorWidth );
        this.navigatorOuter.width( this.settings.maxItemDisplay * this.settings.navigatorWidth );
        this.navigatorOuter.height( this.settings.navigatorHeight );
} else {
        this.navigatorInner.height( this.slides.length * this.settings.navigatorHeight );    

        this.navigatorOuter.height( this.settings.maxItemDisplay * this.settings.navigatorHeight );
        this.navigatorOuter.width( this.settings.navigatorWidth );
    } 

this.navigratorStep = this.__getPositionMode( this.settings.navPosition );      
    this.directionMode = this.__getDirectionMode();  
if( this.settings.direction == 'opacity') {
this.subwrapper.addClass( 'lof-opacity' );
$(this.slides).css('opacity', 0).eq(this.currentNo).css('opacity', 1);
} else { 
        this.subwrapper.css({'left':'-'+this.currentNo*this.maxSize+'px', 'width':(this.maxWidth) * this.slides.length});
    }
    if( this.settings.isPreloaded ) {
        this.preLoadImage( this.onComplete );
    } else {
        this.onComplete();
    }

 }

$.lofSidernews.fn = $.lofSidernews.prototype;
$.lofSidernews.fn.extend = $.lofSidernews.extend = $.extend;

$.lofSidernews.fn.extend({

startUp:function(obj, subwrapper) {
	seft = this;

	this.navigatorItems.each( function(index, item ){
		$(item).click( function(){
			seft.jumping( index, true );
			seft.setNavActive( index, item );                   
		} );
		$(item).css({ 'height': seft.settings.navigatorHeight, 'width': seft.settings.navigatorWidth });
	})
	this.registerWheelHandler( this.navigatorOuter, this );
	this.setNavActive(this.currentNo );

	if( this.settings.buttons && typeof (this.settings.buttons) == "object" ){
		this.registerButtonsControl( 'click', this.settings.buttons, this );

	}
	if( this.settings.auto ) 
	this.play( this.settings.innerinterval, 'next', true );

	return this;
},
onComplete:function(){
	setTimeout( function(){ $('.preload').fadeOut(900); }, 400 );   
	this.startUp();
},
preLoadImage:function( callback ){
	var self = this;
	var images = this.subwrapper.find( 'img' );
var count = 0;
	images.each( function(index,image){ 
		if( !image.complete ){                
			image.onload =function(){
				count++;
				if( count >= images.length ){
					self.onComplete();
				}
			}
			image.onerror =function(){ 
				count++;
				if( count >= images.length ){
					self.onComplete();
				}   
			}
		}else {
			count++;
			if( count >= images.length ){
				self.onComplete();
			}   
		}
	} );
},
navigationAnimate:function(currentIndex) { 

	if (currentIndex <= this.settings.startItem 
	|| currentIndex - this.settings.startItem >= this.settings.maxItemDisplay-1) {
		this.settings.startItem = currentIndex - this.settings.maxItemDisplay+2;
		if (this.settings.startItem < 0) this.settings.startItem = 0;
		if (this.settings.startItem > this.slides.length-this.settings.maxItemDisplay) {
			this.settings.startItem = this.slides.length - this.settings.maxItemDisplay;
		}
	}       

Any assistance would be greatly appreciated.

Thank you.

Answer №1

Have you considered incorporating a slideshow within another slider, such as the Anything Slider, to accommodate additional content? I have personally utilized this technique in my projects and found success in adding customized elements to the slides.

Answer №2

Consider inserting "var" before line 238, resulting in: var self = this;

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

Struggling to delete items from an array in react.js

I am attempting to remove an item from a nested childArray within another Array. This is my current approach: const childArrayHandler = (childData, sub, questionId, data, btnId) => { // Manage color change on click const isInList = selectedBtnL ...

Vue.js: Awaiting Firebase to finish loading

I'm facing an issue with integrating Firebase into a Vue JS component. It seems like the firebase object loads after my component is created. Is there a way to ensure that Firebase is fully loaded before running any JavaScript code? For example, I w ...

"Enhance your Magento store with the ability to showcase multiple configurable products on the category page, even when dropdown values are not

As I work on adding multiple configurable products to a category list page in Magento 1.7.2, I am facing some challenges due to using the Organic Internet SCP extension and EM Gala Colorswatches. While following tutorials from various sources like Inchoo a ...

Using React hooks to transfer an item from one array to another and remove it

export default function ShoppingCart() { const classes = useStyle(); const { productsList, filteredProductsList, setFilteredProductsList, setProductsList, } = useContext(productsContext); const [awaitingPaymentList, setAwaitingPaymentList] = us ...

Tips for dynamically assigning unique IDs to HTML form elements created within a JavaScript loop

let count = 0; while (count < 4) { $('#container').append("<div><input type='textbox' class ='left' id='left-${count}'/><input type='textbox' class ='right' id=' ...

Thorax.js bower installation issue

After following the instructions in this guide: https://github.com/walmartlabs/thorax-seed/blob/master/README.md, I ran into an unexpected issue on my Windows machine. When running npm start It seems like bower is doing a lot of work (presumably loading ...

How can CSS be used to change the text color of input placeholder in Edge Browser?

While using Edge Browser, I encountered an issue where I was unable to change the input placeholder color. The :-ms-input-placeholder selector was not working on Edge, although it functioned properly on IE 10 and IE 11. input:-ms-input-placeholder { ...

Recording setInterval data in the console will display each number leading up to the current count

Currently, I am developing a progress bar that updates based on a counter over time. To achieve this, I opted to utilize a setInterval function which would update the counter every second, subsequently updating the progress bar. However, I encountered an ...

At the ready stance for a particular grade of students attending a class

I have created a page with a navigation menu that can be scrolled using the wheel mouse. My goal is to ensure that the li item with the 'selected' class is always positioned in the first position on the left. Is there a way to achieve this using ...

The text is not meticulously arranged within the designated span

My text-align (center) property doesn't seem to be working correctly with the following code snippet: <span class="info">&nbsp;i&nbsp;<span id="uitleg_itje">Bla bla. </span></span> The CSS for the info class is as fo ...

The app's connection issue persists as the SDK initialization has exceeded the time limit

We are currently facing an issue when trying to publish a new manifest for our app in the store. The Microsoft team in India is encountering an error message that says "There is a problem reaching the app" during validation. It's worth noting that th ...

Tips for removing the y-axis line in ChartJs

How can I hide the y axis line in a bubble chart? I attempted to use the code snippet below but it did not work as expected. yAxes: [{ angleLines: { display: false } }] ...

How can I implement an AJAX request with MongoDB in Node/Express?

Let's begin with a simple webpage: an HTML Form, a button, and a div-box. When the button is clicked, the Form data will be sent via AJAX. The data will then be stored in MongoDB and retrieved into the div-box seamlessly without any page refresh. A ...

Guide on implementing "Displaying 1 of N Records" using the dataTables.js framework

let userTable = $("#user_table").DataTable({ 'sDom': '<"row-drop"<"col-sm-12 row"lr>><"row"t><"row-pager"<"col-sm-12 col-md-5"i><"col-sm-12&qu ...

Mastering the art of utilizing callbacks in AngularJS for consuming an API

Having trouble handling data from an API and structuring it effectively before passing it to the controller. I've created a factory that retrieves user data from the API, but the provideAllUserData function is causing issues. Below is my services.js: ...

The issue with WooCommerce's update_checkout function is that it is not properly updating the available shipping methods

My WooCommerce site includes a function that adds a 4€ fee when the cash on delivery payment method is selected: add_action('woocommerce_cart_calculate_fees', 'increase_cod_cost'); function increase_cod_cost() { if(WC()->sessio ...

Transmit the latest HTML Dom using jQuery AJAX, then store it using PHP

I am attempting to save the current DOM of the document that I am working on to the server using jQuery. However, I am facing an issue when trying to send the DOM value to a PHP file which is responsible for handling the save operation. Below is the code s ...

How to position div elements side by side using CSS and center them, even on IE8

UPDATE: I have discovered that implementing Bart's solution is the correct one. With a 264px wide div containing the other divs and their 1px borders, I achieved the desired effect. I have updated my code to include his answer. Thank you, Bart. Once ...

What steps do I need to take to set up CORS properly in order to prevent errors with

I encountered the following error message: "Access to XMLHttpRequest at 'api-domain' from origin 'website-domain' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HT ...

Removing all Null Form Inputs from the Document Object Model upon Submission utilizing JavaScript

I am currently working on a conditional Shopify form that was passed down to me from another developer. The form utilizes JavaScript/Jquery for field validation, ensuring that all mandatory fields are completed before proceeding to the next step. After mak ...