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

Bootstrap 4 row featuring bottom-aligned buttons on both the left and right sides of the container

There is a row of buttons with two aligned on the left and one on the right: html { position: relative; min-height: 100%; } body { /* Margin bottom by footer height */ margin-bottom: 60px; } .footer { position: absolute; bottom: 0; w ...

Using CSS properties as false values within React applications

Can you provide guidance on using conditional styles with conditional operators? What would be the ideal code example? Is it possible to use non-CSS values? margin: isOpen ? '10px' : undefined margin: isOpen ? '10px' : 'initial&a ...

Dynamic loading of dependent dropdowns for ActiveAdmin based on the selection made in the first dropdown

As a newcomer to the realm of Ruby on Rails and Active Admin, I find myself tasked with creating two dropdown lists: one for location and another for game. The relationship between location and game is crucial here. Upon selecting a location from the drop ...

Putting retrieved data from firebase into an array using Angular and Firebase format

Hey everyone, I'm currently facing an issue with formatting my Firebase data into an array. Below is the service where I am retrieving data from Firebase: File name: subcategory.service.ts export class SubcategoryService { subcategoryRef: Angula ...

Trouble encountered while attempting to choose a single checkbox from within a v-for loop in Vue.js?

<div id="example-1"> <ul> <input type="text" v-model="searchString" placeholder="Filter" /> <p>sortKey = {{sortKey}}</p> <li v-for="item in sortedItems"> <input class="checkbox-align" type="checkbo ...

How can I utilize the "remark" tool to handle Markdown files with URLs that don't adhere to Markdown formatting? Are there any supplemental plugins available for this

My markdown file has frontmatter and sometimes includes inline URLs that are not properly formatted with markdown syntax. I'm looking for a way to handle these non-markdown URLs within the markdown file - possibly by parsing them into HTML URLs using ...

Issue with sizing and panning when using a combination of Three.js and CSS3Renderer

This issue is specific to Chrome. Here's what I have experimented with: I am utilizing the webGL renderer to position a plane geometry in a 3D environment using threejs. This particular code is running within a class, with the scene as one of its me ...

Retrieve information from MySQL database with jQuery upon button click

After fetching multiple data rows from a MySQL database and displaying them in a table, I want to include a button in the last column of each row. The unique ID for each button will be retrieved from the database. When a user clicks on any of these buttons ...

.malfunctioning in Internet Explorer due to compatibility issues

While I have not personally experienced this issue, there seems to be a problem with a form on our website. After changing the value (using .change()), the field is supposed to update by sending data to save.php. However, some users have reported that this ...

A guide to setting a custom icon for the DatePicker component in Material-UI 5

Seeking to incorporate custom Icons from react-feathers, I have implemented a CustomIcon component which returns the desired icon based on the name prop. Below is the code for this component. import React from 'react'; import * as Icon from &apo ...

Experiencing trouble with implementing multiple textboxes based on option selection using javascript

My JavaScript code is supposed to display multiple textboxes based on the user's selection, but for some reason, I can only select one textbox at a time. I'm not sure what's wrong with my code. Here's the snippet of the code: <ht ...

Update the image with a new one using jQuery and PHP, then refresh the page to see

I'm currently utilizing simpleImage, a PHP image manipulation library. My aim is to externally rotate an image using AJAX and replaceWith functions. It successfully replaces the image, but unfortunately it doesn't refresh after rotation. Here&ap ...

the ng-repeat directive disables input controls within the tfoot

When working with JSON data, I encountered a situation where I needed to display different types of student details in a table. For one specific type of student, namely partners, I wanted to include input controls such as checkboxes and buttons. However, e ...

What causes the "Invalid hook call" error to occur when the useQuery function is invoked?

Encountering an issue while trying to use the useQuery() function from react-admin within a custom component. Despite the clear error message, I'm struggling to determine the right course of action. Visiting the provided website and following the inst ...

I'm having an issue where whenever I click on a different page, I keep getting redirected back to the first page

Upon conducting research, I discovered that by implementing the refined code below, I was able to resolve my issue (my other html was also corrected using this solution) setTimeout(function() { datatable_FTP.ajax.reload(null, false); }, 30000); Although I ...

Simultaneously updating the states in both the child and parent components when clicked

In my code, I have two components: the parent component where a prop is passed in for changing state and the child component where the function is called. The function changes the state of the parent component based on an index. changeState={() => this ...

While validating in my Angular application, I encountered an error stating that no index signature with a parameter of type 'string' was found on type 'AbstractControl[]'

While trying to validate my Angular application, I encountered the following error: src/app/register/register.component.ts:45:39 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used ...

Fixed-top navbar in Bootstrap obscuring webpage contents

I have tried various solutions to the issue at hand, but nothing seems to be working. I applied padding-top to the container of my main content, but when I add the following CSS: @media (max-width: 768px) { body{ padding: 0; } } it overrides the padd ...

What is the best way to retrieve dynamic content from a .txt file and have it displayed on multiple HTML pages as they are loaded dynamically?

I have a file named 'm_data.txt' stored on the server that contains a continuous total of 77 (for instance). The total gets updated via a push.php page that writes to the .txt file. <!DOCTYPE html> <html> <head> <title> ...

Can you explain why the .js code is causing such high CPU usage in popular video players?

Why is the .js code running continuously even when the video is paused and there is no user interaction? I observed this phenomenon on a Windows 10 Atom Tablet, particularly when in energy-saving mode. The CPU usage for video playback and decoding almost ...