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初始化之后,数据还未获取到,导致图片还未加载 解决方 ...
随机推荐
- Windows system 在python文件操作时的路径表示方法
file_path =(r'i:\vacpy\ch10\pi_digits.txt') #将文件路径存储在变量file_path中with open (file_path) as file_objec ...
- 用Python3实现的Mycin专家系统简单实例
from sys import stderr ######################### TRUE = 1 #定义返回值 FALSE = 0 FACT_LENGTH = 9 #'''前提与结论 ...
- var,dynamic的用法
private void Form1_Load(object sender, EventArgs e) { var dt = Getuser() as IEnumerable<dynamic&g ...
- c#进阶之泛型
好久没用写博了,感觉工作的越久就越发的懒了,啦啦啦!德玛西亚! 感觉最近食欲不正,便想写写组织下自己的学习路程: 泛型,可能很多朋友在学习这个东西的时候都源于面向对象,当然我也不例外:从一个实体继承另 ...
- (Review cs231n) Object Detection
目标:我们有几个类别,然后我们要在这张图中找到这些类的所有实例 解决思路:是否可以按照回归的思路进行求解呢? 但是受限制于确定的种类输出问题. 方法:分类和回归是解决问题的两个套路,我们现在对于目标的 ...
- linux 看执行任务的一些邮件
cat /var/spool/mail/root From root@hadoop01.localdomain Fri Apr 12 18:44:01 2019 Return-Path: <ro ...
- ceph rbd双挂载导致ext4文件系统inode链接数据污染
转载自:https://my.oschina.net/xueyi28/blog/1596003 ###故障现象 /data/rbd1/dir1/a/file1 /data/rbd1/dir2/a/fi ...
- IDEA日常遇到问题汇总
1. IDEA .gitignore文件不显示在项目栏中 解决方法,setting >> Editor >> Code Style >> File Type &g ...
- MySQL安装时MySQL server一直安装失败日志显示This application requires Visual Studio 2013 Redistributable
使用MySQL社区版的msi包进行安装,试了好多次,别的组件都能正常安装,只有MySQL server的安装状态显示为fail.删除所有安装的程序,包括所依赖的各种Microsoft发布的包,删除所有 ...
- Summary on deep learning framework --- Torch7
Summary on deep learning framework --- Torch7 2018-07-22 21:30:28 1. 尝试第一个 CNN 的 torch版本, 代码如下: -- ...