【Layui】13 轮播 Carousel
文档地址:
https://www.layui.com/demo/carousel.html
基础轮播:
<style>
/* 为了区分效果 */
div[carousel-item]>*{text-align: center; line-height: 280px; color: #fff;}
div[carousel-item]>*:nth-child(2n){background-color: #009688;}
div[carousel-item]>*:nth-child(2n+1){background-color: #5FB878;}
#test2 div[carousel-item]>*{line-height: 120px;}
</style> <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>常规轮播</legend>
</fieldset> <div class="layui-carousel" id="test1" lay-filter="test1">
<div carousel-item="">
<div>条目1</div>
<div>条目2</div>
<div>条目3</div>
<div>条目4</div>
<div>条目5</div>
</div>
</div> <div class="layui-carousel" id="test2" style="margin-top: 15px;">
<div carousel-item="">
<div>条目1</div>
<div>条目2</div>
</div>
</div> <script type="text/javascript">
layui.use(['carousel', 'form'], function(){
let form = layui.form;
let carousel = layui.carousel;
//常规轮播
carousel.render({
elem: '#test1'
,arrow: 'always'
}); //改变下时间间隔、动画类型、高度
carousel.render({
elem: '#test2'
,interval: 1800
,anim: 'fade'
,height: '120px'
});
});
</script>

设置轮播图的容器标签:
id属性用于定位渲染
<div class="layui-carousel" id="test1" lay-filter="test1">
设置轮播图的轮播项的容器标签:
<div carousel-item="">
里面的一个一个即轮播项:
<div>条目1</div>
<div>条目2</div>
<div>条目3</div>
<div>条目4</div>
<div>条目5</div>
图片轮播图:
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
<legend>填充轮播元素 - 以图片为例</legend>
</fieldset> <div class="layui-carousel" id="test10">
<div carousel-item="">
<div><img src="${pageContext.request.contextPath}/resource/img/37864.jpg"></div>
<div><img src="${pageContext.request.contextPath}/resource/img/884938.png"></div>
<div><img src="${pageContext.request.contextPath}/resource/img/1083612.png"></div>
<div><img src="${pageContext.request.contextPath}/resource/img/1083878.png"></div>
<div><img src="${pageContext.request.contextPath}/resource/img/1084102.jpg"></div>
</div>
</div> <script type="text/javascript">
layui.use(['carousel', 'form'], function(){
let form = layui.form;
let carousel = layui.carousel; //图片轮播
carousel.render({
elem: '#test10'
,width: '778px'
,height: '440px'
,interval: 5000
});
});
</script>

【Layui】13 轮播 Carousel的更多相关文章
- thinkphp标签实现bootsrtap轮播carousel实例
thinkphp标签实现bootsrtap轮播carousel实例由于轮播carousel第一个div需要设置active样式才能正常显示,上面的圆点也同样需要数字,使用volist标签在循环的同时可 ...
- Bootstrap历练实例:轮播(carousel)
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- Bootstrap 历练实例-轮播(carousel)插件的事件
事件 下表列出了轮播(Carousel)插件中要用到的事件.这些事件可在函数中当钩子使用. 事件 描述 实例 slide.bs.carousel 当调用 slide 实例方法时立即触发该事件. $(' ...
- Bootstrap 历练实例-轮播(carousel)插件方法
方法 下面是一些轮播(Carousel)插件中有用的方法: 方法 描述 实例 .carousel(options) 初始化轮播为可选的 options 对象,并开始循环项目. $('#identifi ...
- Bootstrap 轮播(Carousel)插件
轮播插件是一种灵活的响应式的向站点添加滑块的方式.除此之外,内容也是非常灵活的.可是图像,内嵌框架,视频或者其它您想的放置任何内容的类型. 下面是一个简单的幻灯片,使用轮播(carousel)插件显示 ...
- layui(八)——轮播图常见用法总结
carousel 是 layui 2.0 版本中新增的全新模块,主要适用于跑马灯/轮播等交互场景.它可以满足任何类型内容的轮播式切换操作,更可以胜任 FullPage (全屏上下轮播)的需求,简洁而不 ...
- Bootstrap的js插件之轮播(carousel)
轮播请查看下面演示样例.基本已经涵盖最经常使用的一个轮播 <!DOCTYPE html> <html lang="en"> <head> < ...
- BootStrap 轮播 Carousel
参考 http://wrongwaycn.github.io/bootstrap/docs/javascript.html#collapse 同样 启动方式有2种 一种是在div的class中加 另 ...
- 关于Layui 响应式移动端轮播图的问题
用layui做轮播图,在手机上宽度异常, 可通过以下方法解决, 不喜欢layui的同学可以选择Swiper // 轮播图 layui.use('carousel', function () { var ...
- layui常用插件(一) 轮播图
轮播图 <html lang="en"> <head> <meta charset="UTF-8"> <meta ht ...
随机推荐
- LeetCode 675. Cut Off Trees for Golf Event 为高尔夫比赛砍树 (C++/Java)
题目: You are asked to cut off trees in a forest for a golf event. The forest is represented as a non- ...
- 不挑电脑安装 WIndows11 用 Rufus这个软件
下 Rufus 找一个U盘先别动 然后去夸克网盘下载 windows11 24h2 iso 版本的安装文件,陶10块钱加速下载下来 然后安装Rufus 然后使用这个启动盘制作工具选择下载好的 iso原 ...
- IDEA 新建 MAVEN JAVA 控制台程序 Console
IDEA 新建 MAVEN JAVA 控制台程序 Console File - New - Project-左侧选择 Maven,右侧勾选"Create from archetype&quo ...
- asp.net core mvc 使用quartz
参照了:https://www.cnblogs.com/dangzhensheng/p/10496278.html 1.新建任务类ReportJob.cs,这个类里就是具体任务了. using Qua ...
- 内部网关协议RIP-路由选择协议
路由信息协议RIP(Routing Information Protocol)是内部网关协议IGP中最先得到广泛使用的协议,其相关标准文档为RFC1058. 一.RIP基本工作原理 RIP要求自治系统 ...
- Bean Searcher v4.3.0 重大更新!
往期阅读: 我这样写代码,比直接使用 MyBatis 效率提高了 100 倍 最近火起的 Bean Searcher 与 MyBatis Plus 倒底有啥区别? Bean Searcher v3.8 ...
- CountDownLatch demo演示数据分片多线程处理
# CountDownLatch demo演示数据分片多线程处理 package com.example.core.mydemo; import org.springframework.schedul ...
- 随机二次元图片API上线
Tips:当你看到这个提示的时候,说明当前的文章是由原emlog博客系统搬迁至此的,文章发布时间已过于久远,编排和内容不一定完整,还请谅解` 随机二次元图片API上线 日期:2017-12-6 阿珏 ...
- typora中LaTeX公式常用指令
# typora中LaTeX公式常用指令 以下指令只能保证在typora中完美显示,但是在其他编辑器中可能会部分不支持 \cal F.X.Y = KaTeX parse error: Expected ...
- Controller-runtime模块
Controller-runtime框架 Controller-runtime是社区提供的用于开发Controller的框架,包含了各种已封装的代码库.Kubebuilder与Operator SDK ...