📜 ⬆️ ⬇️

Small fix for coda-slider

Hello. The problem is that at the moment in the coda-slider plugin there is no adding a class for the current panel. It has the ability to add the current class to the dynamic tab, if they are enabled in the settings. But, I needed to add the current class to the elements that are scrolled by the slider.



To do this, you need to write one small function, inside the plugin itself:
')
return this .each( function (){

// Uncomment the line below to test your preloader
// alert("Testing preloader");

var slider = $( this );

// to add current class to current panel
slider.setCurrentPanel = function () {
$( '.panel' , slider).removeClass( 'current' );
$( '.panel:eq(' + (currentPanel-1) + ')' , slider).addClass( 'current' );
}


* This source code was highlighted with Source Code Highlighter .


After that, we just have to insert the function call in those places where the currentPanel variable is changing (lines 83, 99, 119, 226)

slider.setCurrentPanel();

* This source code was highlighted with Source Code Highlighter .


Here is a modified file. I hope someone come in handy. slider

Source: https://habr.com/ru/post/93737/


All Articles