vue手把手教你实现走马灯商品左右轮播图
<template>
<div>
<div class="back_add">
<div class="threeImg">
<div class="Containt">
<div class="iconleft" @click="zuohua">
<i class="el-icon-arrow-left"></i>
</div>
<ul :style="{'left':calleft + 'px'}" v-on:mouseover="stopmove()" v-on:mouseout="move()">
<li v-for="(item,index) in superurl" :key="index">
<img :src="item.img">
</li>
</ul>
<div class="iconright" @click="youhua">
<i class="el-icon-arrow-right"></i>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
superurl: [
{
url: "",
img:
"https://img.mukewang.com/szimg/5ac2dfe100014a9005400300-360-202.jpg"
},
{
url: "",
img:
"https://img.mukewang.com/szimg/5c62a4dc0812e84106000338-360-202.jpg"
},
{
url: "",
img:
"https://img.mukewang.com/szimg/5c7c82630820acf806000338-360-202.jpg"
},
{
url: "",
img:
"https://img.mukewang.com/szimg/5c7e6835087ef3d806000338-360-202.jpg"
},
{
url: "",
img:
"https://img.mukewang.com/szimg/59b8a486000107fb05400300-360-202.jpg"
},
{
url: "",
img:
"https://img.mukewang.com/szimg/5c7516fa081aab2b06000338-360-202.jpg"
}
],
calleft: 0
};
},
created() {
this.move();
},
methods: {
//移动
move() {
this.timer = setInterval(this.starmove, 5000);
},
//开始移动
starmove() {
this.calleft -= 340;
if (this.calleft < -1200) {
this.calleft = 0;
}
},
//鼠标悬停时停止移动
stopmove() {
clearInterval(this.timer);
},
//点击按钮左移
zuohua() {
this.calleft -= 340;
if (this.calleft < -1200) {
this.calleft = 0;
}
},
//点击按钮右移
youhua() {
this.calleft += 340;
if (this.calleft > 0) {
this.calleft = -1020;
}
}
}
};
</script> <style scoped>
/*超链接图片*/ #divAdd {
background-color: #ededed;
/*width: 100%;*/
/*min-width: 1200px;*/
width: 1000px;
margin: 0px auto;
} .divAdd-con {
margin: 0px auto;
width: 1000px;
overflow: auto;
padding: 30px 0px;
} .divAdd-con img {
float: left;
} .indexrt {
margin: 0px 40px;
} .divAddleft img {
float: left;
margin-bottom: 7px;
} .divAddleft {
float: left;
display: inline;
width: 370px;
} .divAddrt {
float: right;
display: inline;
margin-top: 7px;
} .back_add {
background-color: #ededed;
} .divAdd-con img {
border: none;
} a:focus,
a:hover {
color: #23527c;
} .threeImg {
height: 158px;
background: #ededed;
border-bottom: 3px solid #4679b2;
min-width: 1000px;
} .threeImg .Containt ul {
margin: 0 auto;
width: 2400px;
position: absolute;
left: 0px;
cursor: pointer;
height: 100%;
} .threeImg .Containt ul li {
width: 300px;
margin-right: 40px;
margin-top: 10px;
float: left;
} .threeImg .Containt ul li img {
height: 128px;
width: 100%;
} .Containt {
position: relative;
width: 1000px;
height: 130px;
overflow: hidden;
margin: 0 auto;
} .iconleft {
position: absolute;
width: 20px;
height: 80px;
top: 10px;
z-index: 99999;
padding-top: 48px;
background-color: #ddd;
vertical-align: middle;
} .iconright {
position: relative;
left: 978px;
top: 70px;
background-color: #ddd;
/*position: absolute;*/
width: 20px;
height: 80px;
top: 10px;
z-index: 99999;
padding-top: 48px;
background-color: #ddd;
vertical-align: middle;
}
</style>
vue手把手教你实现走马灯商品左右轮播图的更多相关文章
- vue项目中,使用vue-awesome-swiper插件实现轮播图
一.安装 npm install vue-awesome-swiper 二.项目中引入 import 'swiper/dist/css/swiper.css'import {swiper,swiper ...
- 设置头像、商品、轮播图为背景图时需要的css
background-repeat: no-repeat;background-size: cover;background-position: center center;
- iOS回顾笔记(05) -- 手把手教你封装一个广告轮播图框架
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,bi ...
- 七、Vue组件库:Element、Swiper(轮播专用组件)
一.vue的Element组件库 官网:https://element.eleme.cn/#/zh-CN 1.1安装 推荐安装方法: 首先要进入项目目录 cnpm i element-ui -S 或 ...
- 带轮播图、导航栏、商品的简单html,以及轮播图下边数字随轮播图的改变而改变
---恢复内容开始--- 在做这个的时候,最不会的是中间轮播图下边的数字是如何实现转变的,后来加入了jQuery就能实现了. css部分: <style type="text/css& ...
- vue轮播图插件vue-awesome-swiper的使用与组件化
不管是APP还是移动端网页开发,轮播图在大部分项目当中都是存在的,这时候如果用vue开发项目,选择一款好的插件并且封装好是很重要的 1. 推荐使用vue-awesome-swiper 安装:cnpm ...
- vue music-抓取歌单列表数据(渲染轮播图)
下载安装新依赖 babel-runtime:对es6语法进行转译 fastclick:对移动端进行点击300毫秒延迟 ,,取消掉 babel-polyfill:API 先添加,在npm install ...
- vue轮播图
vue开发中遇到这样一个需求实现导航栏和中间内容相结合实现页面滑动导航跟随改变的效果.看效果: 这里我用的是vue所带的插件:vue-awesome-swiper,传送门:https://www.np ...
- vue.js学习之better-scroll封装的轮播图初始化失败
vue.js学习之better-scroll封装的轮播图初始化失败 问题一:slider组件初始化失败 原因:页面异步获取数据很慢,导致slider初始化之后,数据还未获取到,导致图片还未加载 解决方 ...
随机推荐
- Requests卡死问题
https://www.cnblogs.com/niansi/p/7143736.html https://blog.csdn.net/pilipala6868/article/details/807 ...
- Makefile 编译时虽然加上了-g 选项 但是还是无法调试
make 编译时默认的命令是all,不能写成其他的
- Keepalived配置文件详解
global_defs { router_id LVS_$prio #节点唯一标识,通常为hostname } local_address_group laddr_g1 { ${lvs_node} # ...
- Python的伪造数据生成器:Faker
我们在开发中常常需要利用一些假数据来做测试,这种时候就可以使用 Faker 来伪造数据从而用来测试. Faker 是一个可以让你生成伪造数据的Python包.当你需要初始化数据库,创建美观的XML文档 ...
- SynchronousQueueDemo
1.ArrayDeque, (数组双端队列) 2.PriorityQueue, (优先级队列) 3.ConcurrentLinkedQueue, (基于链表的并发队列) 4.DelayQueue, ( ...
- CCF CSP 201503-2 数字排序 (map+自定义排序)
题目链接:http://118.190.20.162/view.page?gpid=T26 返回试题列表 问题描述 试题编号: 201503-2 试题名称: 数字排序 时间限制: 1.0s 内存限制: ...
- mysql_study_3
代码: CREATE DATABASE test_01; CREATE DATABASE mysql_shiyan; use mysql_shiyan; CREATE TABLE department ...
- 中国省市县数据库sql文件(2017年10月31日之前)
摘自国家统计局 sql文件下载地址:https://files.cnblogs.com/files/zxj95121/%E7%9C%81%E5%B8%82%E5%8E%BFsql.zip 2019.4 ...
- SlidingMenu第二篇 --- SlidingMenu常用属性介绍
/** * 设置滑动的屏幕范围 * 1. TOUCHMODE_MARGIN 设置为全屏边缘可滑动 * 2. TOUCHMODE_FULLSCREEN 设置为全屏区域都可以滑动 * 3. TOUCHMO ...
- 认识volatile的工作原理
前言 在多线程并发编程中synchronized和Volatile都扮演着重要的角色,Volatile是轻量级的synchronized,它在多处理器开发中保证了共享变量的“可见性”.可见性的意思是当 ...