/*//////////////////////////////////////////////// kf-slider ////////////////////////////////////////////////*/
function kfSliderPrev() {
    if ($('.kf-slider.kf-active').index() == 0) {
        $('.kf-slider:last-child').addClass('kf-active').siblings().removeClass('kf-active');
    } else {
        $('.kf-slider.kf-active').removeClass('kf-active').prev().addClass('kf-active');
    }
}

function kfSliderNext() {
    if ($('.kf-slider.kf-active').index() == $('.kf-slider').length - 1) {
        $('.kf-slider:first-child').addClass('kf-active').siblings().removeClass('kf-active');
    } else {
        $('.kf-slider.kf-active').removeClass('kf-active').next().addClass('kf-active');
    }
}
let kfSliderAuto = setInterval(() => {
 
}, 5000);

function kfSliderUpdate() {
    if ($('.kf-slider.kf-active').index() == $('.kf-slider').length - 1) {
        $('.kf-slider:first-child').addClass('kf-next').siblings().removeClass('kf-next');
        $('.kf-slider.kf-active').prev().addClass('kf-prev').siblings().removeClass('kf-prev');
    } else if ($('.kf-slider.kf-active').index() == 0) {
        $('.kf-slider.kf-active').next().addClass('kf-next').siblings().removeClass('kf-next');
        $('.kf-slider:last-child').addClass('kf-prev').siblings().removeClass('kf-prev');
    } else {
        $('.kf-slider.kf-active').next().addClass('kf-next').siblings().removeClass('kf-next');
        $('.kf-slider.kf-active').prev().addClass('kf-prev').siblings().removeClass('kf-prev');
    }
}
setInterval(() => {
    kfSliderUpdate()
}, 0);
$('.kf-slider-next-btn').click(function () {
    clearInterval(kfSliderAuto);
    kfSliderNext();
    kfSliderUpdate();
})
$('.kf-slider-prev-btn').click(function () {
    clearInterval(kfSliderAuto);
    kfSliderPrev();
    kfSliderUpdate();
})



/*/////////////////////////////////////////////// RGB ///////////////////////////////////////////////*/
$('.rgb-btns div:nth-child(1)').addClass('active').siblings().removeClass('active');
$('.rgb-bgs>*:nth-child(1)').addClass('active').siblings().removeClass('active');
$('.rgb-btns div').click(function () {
    $(this).addClass('active').siblings().removeClass('active');
    var index = $(this).index() + 1;
    $('.rgb-bgs>*:nth-child(' + index + ')').addClass('active').siblings().removeClass('active');
    $('.rgb-gesture').remove();
});

// var wheelPicker = new iro.ColorPicker("#wheelPicker", {
//     width: 100,
//     color: "rgb(70, 230, 230)",
//     borderWidth: 0,
//     borderColor: "#fff0",
//     layout: [{
//         component: iro.ui.Wheel,
//     }, ]
// });

// wheelPicker.on(['color:init', 'color:change'], function (color) {
//     $('.rgb-bg-fill').css('fill', color.hexString);
// });

// var sliderPicker = new iro.ColorPicker("#sliderPicker", {
//     width: 300,
//     color: "rgb(70, 230, 230)",
//     borderWidth: 0,
//     borderColor: "#fff0",
//     layout: [{
//             component: iro.ui.Slider,
//             options: {
//                 sliderType: 'hue',
//                 sliderSize: '20'
//             }
//         },
//         {
//             component: iro.ui.Slider,
//             options: {
//                 sliderType: 'saturation',
//                 sliderSize: '20'
//             }
//         },
//     ]
// });

// sliderPicker.on(['color:init', 'color:change'], function (color) {
//     $('.rgb-bg-fill').css('fill', color.hexString);
// });