69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
const fullscreencar = {
|
|
|
|
}
|
|
|
|
let home_car_current = 1;
|
|
|
|
let home_car_item_length = document.querySelectorAll(".home-car-item").length;
|
|
|
|
function home_car_init() {
|
|
document.querySelectorAll(".home-car-item").forEach(
|
|
function(element, index) {
|
|
element.style.order = index+1;
|
|
});
|
|
}
|
|
|
|
home_car_init();
|
|
|
|
function home_car_update_order() {
|
|
if (home_car_current == home_car_item_length) {
|
|
home_car_current = 1;
|
|
} else {
|
|
home_car_current++;
|
|
}
|
|
|
|
let order = 1;
|
|
|
|
for (let i = home_car_current; i <= home_car_item_length; i++) {
|
|
document.querySelector(".home-car-item[data-position='" + i + "']").style.order = order;
|
|
order++;
|
|
}
|
|
|
|
for (let i = 1; i < home_car_current; i++) {
|
|
document.querySelector(".home-car-item[data-position='" + i + "']").style.order = order;
|
|
order++;
|
|
}
|
|
|
|
document.querySelector("#home-car-container").classList.remove('home-car-trans');
|
|
document.querySelector("#home-car-container").style.transform = 'translateX(0)';
|
|
|
|
}
|
|
|
|
function home_car_next() {
|
|
document.querySelector("#home-car-container").classList.add('home-car-trans');
|
|
document.querySelector("#home-car-container").style.transform = 'translateX(-100%)';
|
|
// home_car_update_order();
|
|
setTimeout(function(){console.log("check")
|
|
home_car_update_order();
|
|
},3000);
|
|
}
|
|
|
|
function home_car_loop() {
|
|
setInterval( function() {
|
|
home_car_next();
|
|
},10000);
|
|
}
|
|
|
|
home_car_loop();
|
|
|
|
let vm = new Vue ({
|
|
el: "#root",
|
|
data () {
|
|
return {
|
|
text1: "Yolo world"
|
|
}
|
|
}
|
|
|
|
})
|
|
|