原生js实现一个图片幻灯片轮换效果代码
代码语言:html
所属分类:幻灯片
代码描述:原生js实现一个图片幻灯片轮换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.5.11.2.css"> <style> body { margin: 0; display: flex; justify-content: center; height: 100vh; align-items: center; background-color: wheat; } .slider-container { position: relative; width: 500px; height: 300px; overflow: hidden; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); } .image-container { display: flex; transition: transform 0.4s ease-in-out; } .btn { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 20px; opacity: 0.5; cursor: pointer; } .btn.prev { left: 10px; } .btn.next { right: 10px; } .btn:hover { opacity: 1; } </style> </head> <body translate="no"> <div class="slider-container"> <div class="image-container"> <img src="//repo.bfw.wiki/bfwrepo/image/6306b35ab8de2.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_500,h_300,/quality,q_90" alt="image"> <img src="//repo.bfw.wiki/bfwrepo/image/6323c19e047f5.png?x-oss-process=image/auto.........完整代码请登录后点击上方下载按钮下载查看
网友评论0