Click-activated fluid width slider

Developer
Size
2,567 Kb
Views
10,120

How do I make an click-activated fluid width slider?

What is a click-activated fluid width slider? How do you make a click-activated fluid width slider? This script and codes were developed by Jesper Hills on 13 October 2022, Thursday.

Click-activated fluid width slider Previews

Click-activated fluid width slider - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Click-activated fluid width slider</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { overflow: hidden;
}
.carousel { width: 50%; position: relative; margin: 40px auto;
}
.viewport { width: 100%; height: 100%; position: absolute; top: 0; left: 0;
}
ul { width: 400%; height: 100%; position: absolute; overflow: hidden; top: 0; left: 0; transition: left 1s;
}
li { width: 25%; height: 100%; float: left; opacity: 0.5; cursor: pointer; position: relative; transition: opacity 0.3s; display: table;
}
li:hover, li.active { opacity: 1;
}
li span { display: table-cell; position: relative; height: 100%; vertical-align: middle;
}
li img { width: 68%; display: block; margin: 0 auto; transition: width 1s, left 0.2s, right 0.2s; position: relative;
}
img.setter { display: block; width: 100%; height: 100%; position: relative; visibility: hidden; }
li.active img { margin: 0 auto; width: 100%; top: 0; left: 0 !important; right: 0 !important; } </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="carousel"> <img class="setter" src="//placehold.it/600x400" /> <div class="viewport"> <ul> <li class="active"> <span><img src="//placehold.it/600x400" /></span> </li> <li class="n"> <span><img src="//placehold.it/600x400" /></span> </li> <li> <span><img src="//placehold.it/600x400" /></span> </li> <li> <span><img src="//placehold.it/600x400" /></span> </li> </ul> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Click-activated fluid width slider - Script Codes CSS Codes

body { overflow: hidden;
}
.carousel { width: 50%; position: relative; margin: 40px auto;
}
.viewport { width: 100%; height: 100%; position: absolute; top: 0; left: 0;
}
ul { width: 400%; height: 100%; position: absolute; overflow: hidden; top: 0; left: 0; transition: left 1s;
}
li { width: 25%; height: 100%; float: left; opacity: 0.5; cursor: pointer; position: relative; transition: opacity 0.3s; display: table;
}
li:hover, li.active { opacity: 1;
}
li span { display: table-cell; position: relative; height: 100%; vertical-align: middle;
}
li img { width: 68%; display: block; margin: 0 auto; transition: width 1s, left 0.2s, right 0.2s; position: relative;
}
img.setter { display: block; width: 100%; height: 100%; position: relative; visibility: hidden; }
li.active img { margin: 0 auto; width: 100%; top: 0; left: 0 !important; right: 0 !important; }

Click-activated fluid width slider - Script Codes JS Codes

var carousel = { item: $(".carousel li"), list: $(".carousel ul")
};
carousel.item.on("click", function(){ var el = $(this); carousel.list.css({ "left": "-"+(el.index()*100)+"%" }); carousel.item.removeClass(); el.addClass("active"); el.prev().addClass("p"); el.next().addClass("n");
});
Click-activated fluid width slider - Script Codes
Click-activated fluid width slider - Script Codes
Home Page Home
Developer Jesper Hills
Username nopr
Uploaded October 13, 2022
Rating 3
Size 2,567 Kb
Views 10,120
Do you need developer help for Click-activated fluid width slider?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Jesper Hills (nopr) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!