mirror of https://github.com/4xmen/xshop.git
improve js quality
parent
5e7820061a
commit
8773db7d99
@ -1,30 +1,34 @@
|
||||
import {tns} from "tiny-slider/src/tiny-slider";
|
||||
|
||||
var sliderSimple ;
|
||||
var sliderSimple;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
try {
|
||||
document.querySelectorAll('.SliderSimple')?.forEach(function (el) {
|
||||
if (el.classList.contains('.tns-slider')){
|
||||
console.log('ignore');
|
||||
return 'ignore';
|
||||
}
|
||||
sliderSimple = tns({
|
||||
container: el,
|
||||
items: 1,
|
||||
autoplay: true,
|
||||
autoplayButton: false,
|
||||
// nextButton: false,
|
||||
controls: false,
|
||||
autoplayHoverPause: true,
|
||||
mouseDrag: true,
|
||||
slideBy: 1,
|
||||
autoplayTimeout: 5000,
|
||||
// speed:10000,
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
}
|
||||
try {
|
||||
if (document.querySelectorAll('.SliderSimple').length != 0) {
|
||||
|
||||
document.querySelectorAll('.SliderSimple')?.forEach(function (el) {
|
||||
if (el.classList.contains('.tns-slider')) {
|
||||
console.log('ignore');
|
||||
return 'ignore';
|
||||
}
|
||||
sliderSimple = tns({
|
||||
container: el,
|
||||
items: 1,
|
||||
autoplay: true,
|
||||
autoplayButton: false,
|
||||
// nextButton: false,
|
||||
controls: false,
|
||||
autoplayHoverPause: true,
|
||||
mouseDrag: true,
|
||||
slideBy: 1,
|
||||
autoplayTimeout: 5000,
|
||||
// speed:10000,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
} catch {
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue