


JavaScript carousel and custom scroll bar with mouse wheel sharing code post
This is a carousel image I made myself. You can take a look at it. I haven’t optimized it yet. If you have any improvements, you can privately chat
You can handle the layout yourself
<div class="slider" id="circle"> <a href=""><img src="img/6p.jpg" alt="" /></a> ` <ul class="circle" > <li onclick="lun(1)" id="ico1">1</li> <li onclick="lun(2)" id="ico2">2</li> <li onclick="lun(3)" id="ico3">3</li> <li onclick="lun(4)" id="ico4">4</li> <li onclick="lun(5)" id="ico5">5</li> <li class="current" onclick="lun(6)" id="ico6">6</li> </ul> <div class="arrow"> <a href="javaScript:;" class="arrow-l"onclick="bo2()" id="bo1"><</a> <a href="javaScript:;" class="arrow-r"onclick="bo1()" id="bo2">></a> </div> </div> <script> var c = 0 ; var t ; window.onload = function () { t = setInterval("bo1()",5000); } function lun(num){ c = num ; var ptn = document.getElementById("circle").getElementsByTagName("img")[0]; for (var i = 1 ; i < 7;i++ ) { var li = document.getElementById("circle").getElementsByTagName("li")[i-1]; li.style.backgroundColor = "#3E3E3E"; if (num == i) { ptn.src = "img/"+ i + "p.jpg"; li.style.backgroundColor = "#B61B1F"; } } } function bo1() { if(c>=6){ c = 0 ; } c++; lun(c); } function bo2() { if(c<=1){ c = 7 ; } c--; lun(c); } </script>
Let’s take a look at the custom scroll bar with the mouse wheel DEMO
The specific code is as follows:
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"/> <link href="css/reset.css" rel="stylesheet" type="text/css"> <style type="text/css"> body { font-size: 14px; font-family: Microsoft YaHei, Tahoma, Geneva, sans-serif; background: #111; } #content ul { width: 960px; margin: 150px auto; padding: 60px 0; } #content ul li { margin-right: 20px; width: 225px; height: 180px; float: left; } #content ul li:last-child { margin-right: 0; } #content ul li a { position: relative; display: block; width: 100%; height: 100%; /*舞台(动画元素的父容器)perspective*/ -webkit-perspective: 800px; -moz-perspective: 800px; } #content ul li a > div { position: absolute; left: 0; height: 0; width: 100%; height: 100%; color: #fff; /*动画元素transform-style*/ -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; -webkit-transition: .8s ease-in-out ; -moz-transition: .8s ease-in-out ; /*动画元素背后设置为hidden*/ -webkit-backface-visibility: hidden; -moz-backface-visibility: hidden; } #content ul li a div:first-child { /* 绕y轴旋转 */ -webkit-transform: rotateY(0); -moz-transform: rotateY(0); z-index: 2; } #content ul li a div:last-child { background: url("images/bg.jpg") no-repeat 0 0; -webkit-transform: rotateY(180deg); -moz-transform: rotateY(180deg); z-index: 1; } #content ul li a:hover div:first-child { -webkit-transform: rotateY(-180deg); -moz-transform: rotateY(-180deg); } #content ul li a:hover div:last-child { -webkit-transform: rotateY(0); -moz-transform: rotateY(0); } #content ul li a div h3 { margin: 0 auto 15px; padding: 15px 0; width: 200px; height: 16px; line-height: 16px; font-size: 14px; text-align: center; border-bottom: 1px #fff dashed; } #content ul li a div p { padding: 0 10px; font-size: 12px; text-indent: 2em; line-height: 18px; } </style> </head> <body> <div id="content"> <ul> <li> <a href="#" target="_blank"> <div><img alt="" src="images/1.jpg"/></div> <div> <h3>漩涡鸣人</h3> <p>日本漫画家岸本齐史作品《火影忍者》中男主角。因为身上封印着邪恶的九尾妖狐,无父无母的他受尽了村人的冷眼与歧视,他下定决心要成为第六代火影,让所有人都认同他的存在。</p> </div> </a> </li> <li> <a href="#" target="_blank"> <div> <img alt="" src="images/2.jpg"/> </div> <div> <h3>日向雏田</h3> <p> 日本漫画家岸本齐史作品《火影忍者》中的3号女主角。木叶忍者村的女忍者,木叶名门日向一族宗家族长的长女。喜欢漩涡鸣人,原本是个性格柔弱的女孩,但是在鸣人的影响下逐渐变得坚强,并逐渐成长为一名优秀的忍者。</p> </div> </a> </li> <li> <a href="#" target="_blank"> <div><img alt="" src="images/3.jpg"/></div> <div> <h3>蒙奇·D·路飞</h3> <p>蒙奇·D·路飞 是日本人气动漫 《海贼王》中的主人公。是日本人气动漫 《海贼王》中的主人公。草帽海贼团船长,梦想是找到传说中的宝藏 —— ONE PIECE,成为海贼王。</p> </div> </a> </li> <li> <a href="#" target="_blank"> <div> <img alt="" src="images/4.jpg"/> </div> <div> <h3>盒子先生</h3> <p> Danbo是一只用废纸盒DIY出来的可爱玩偶,圆圆的眼睛和三角形的嘴巴,时刻露出无辜的表情,让人看到就心软,Danbo是个纯真善良的小家伙,在它单纯的幻想世界里,总是透露出最纯真可爱的动人气息。</p> </div> </a> </li> </ul> </div> </body> </html>
The above is the JavaScript carousel and custom scrolling introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!
For more JavaScript carousel images and custom scroll bars with mouse wheel sharing code posts, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.

Explore the implementation of panel drag and drop adjustment function similar to VSCode in the front-end. In front-end development, how to implement VSCode similar to VSCode...
