JSFiddle - React, Tailwind, and code Playground
by kiokotzu
JavaScript
// JavaScript Document
jQuery(function(){
var iconLegales = jQuery("#iconosLegales").detach();
var logoVigilado= jQuery("#viglogo").detach();
jQuery("#footerContainer").prepend(iconLegales);
jQuery(".icon-rot").prepend(logoVigilado);
var auto=null;
jQuery.fn.corfislider=function(intervalo){
//jQuery( "[data-control='adelante']" ).off("click");
var slider=jQuery(this),
i=parseInt(slider.children("div").length)-1,
estado=false,
slideControl = slider.children('.controles-slider');
function autoPlay(){
jQuery("#autoBoton").trigger("click");
}
auto=setInterval(autoPlay, intervalo);
jQuery(jQuery(this).children()).each(function(index){
jQuery(slideControl).hide();
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-src")+"')");
jQuery(slideControl[index]).show();
console.log(jQuery(slideControl[index]))
/*if(parseFloat(screen.width)<=768 && parseFloat(screen.width)>=400){
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-tablet-src")+"')");
}else if(parseFloat(screen.width)<400){
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-movil-src")+"')");
}else{
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-src")+"')");
}*/
});
jQuery("[data-control], #autoBoton").on("click", function(event){
clearInterval(auto);
if(jQuery(this).attr("data-control")=="adelante"){
var miControl=jQuery(this);
miControl.attr("data-control", "void");
if(estado){
slider.children("div").fadeIn("slow");
estado=false;
miControl.attr("data-control", "adelante");
}else{
slider.children("div").eq(i).fadeOut("slow", function() {
miControl.attr("data-control", "adelante");
if(i<=1){
i=parseInt(slider.children("div").length)-1;
estado=true;
}else{
i--;
}//Fin if...