简体   繁体   中英

Foundation 6, reInit slider plugin with new settings / options

How can i change a plugin's settings/options dynamically. In this case slider plugin. I am trying to change data-step .

Here what i tried:

function changeDataStep($val) {
           var slider = new Foundation.Slider( $('#slider') );
           $('#slider').foundation('destroy');
           slider = new Foundation.Slider( $('#slider'), { dataStep: $val } );
}

Attributes which starts with data in javascript is the source of confusion.

Correct Way is:

function changeDataStep($val) {
           var slider = new Foundation.Slider( $('#slider') );
           slider = new Foundation.Slider( $('#slider'), { step: $val } );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM