Commit 879e61d2 by junxiang wang

后台发布版本2020-09-02 23:10

parent 45d2ca3a
......@@ -18,7 +18,7 @@
position: absolute;
width: 100%;
height: 100%;
background-image: url("/images/load/hello.png");
background-image: url("/images/feature/feature-bg.png");
background-size: cover;
background-repeat: no-repeat;
background-position: bottom center;
......
{
"presets": ["es2015"]
}
node_modules
\ No newline at end of file
let {series,parallel,src,dest, watch } = require("gulp");
let del = require("delete");
let prefixcss = require("gulp-autoprefixer");
let cssnano = require("gulp-cssnano");
let autoprefixer = require('gulp-autoprefixer');
let babel = require('gulp-babel');
function clean(cb) {
del("build/");
cb();
}
let css = function(cb){
return src(["src/css/*.css"])
.pipe(autoprefixer({
cascade: true, //是否美化属性值 默认:true 像这样:
remove: true //是否去掉不必要的前缀 默认:true
}))
.pipe(cssnano())
.pipe(dest("build/css"));
cb();
}
let js = function(cb){
return src(["src/js/*.js"])
.pipe(babel())
.pipe(dest("build/js"));
cb();
}
exports.default = series(clean,css,js);
木兰宽松许可证, 第1版
木兰宽松许可证, 第1版
2019年8月 http://license.coscl.org.cn/MulanPSL
您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第1版(“本许可证”)的如下条款的约束:
0. 定义
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
“法人实体”是指提交贡献的机构及其“关联实体”。
“关联实体”是指,对“本许可证”下的一方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
1. 授予版权许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
2. 授予专利许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括仅因您或他人修改“贡献”或其他结合而将必然会侵犯到的专利权利要求。如您或您的“关联实体”直接或间接地(包括通过代理、专利被许可人或受让人),就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
3. 无商标许可
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。
4. 分发限制
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
5. 免责声明与责任限制
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
条款结束。
如何将木兰宽松许可证,第1版,应用到您的软件
如果您希望将木兰宽松许可证,第1版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步:
1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中;
3, 请将如下声明文本放入每个源文件的头部注释中。
Copyright (c) [2019] [name of copyright holder]
[Software Name] is licensed under the Mulan PSL v1.
You can use this software according to the terms and conditions of the Mulan PSL v1.
You may obtain a copy of Mulan PSL v1 at:
http://license.coscl.org.cn/MulanPSL
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
PURPOSE.
See the Mulan PSL v1 for more details.
Mulan Permissive Software License,Version 1
Mulan Permissive Software License,Version 1 (Mulan PSL v1)
August 2019 http://license.coscl.org.cn/MulanPSL
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v1 (this License) with following terms and conditions:
0. Definition
Software means the program and related documents which are comprised of those Contribution and licensed under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, or are controlled by, or are under common control with a party to this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
Contribution means the copyrightable work licensed by a particular Contributor under this License.
1. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
2. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed, excluding of any patent claims solely be infringed by your or others’ modification or other combinations. If you or your Affiliates directly or indirectly (including through an agent, patent licensee or assignee), institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
3. No Trademark License
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4.
4. Distribution Restriction
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
5. Disclaimer of Warranty and Limitation of Liability
The Software and Contribution in it are provided without warranties of any kind, either express or implied. In no event shall any Contributor or copyright holder be liable to you for any damages, including, but not limited to any direct, or indirect, special or consequential damages arising from your use or inability to use the Software or the Contribution in it, no matter how it’s caused or based on which legal theory, even if advised of the possibility of such damages.
End of the Terms and Conditions
How to apply the Mulan Permissive Software License,Version 1 (Mulan PSL v1) to your software
To apply the Mulan PSL v1 to your work, for easy identification by recipients, you are suggested to complete following three steps:
i. Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
ii. Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
iii. Attach the statement to the appropriate annotated syntax at the beginning of each source file.
Copyright (c) [2019] [name of copyright holder]
[Software Name] is licensed under the Mulan PSL v1.
You can use this software according to the terms and conditions of the Mulan PSL v1.
You may obtain a copy of Mulan PSL v1 at:
http://license.coscl.org.cn/MulanPSL
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
PURPOSE.
See the Mulan PSL v1 for more details.
\ No newline at end of file
# 3dSwiper
#### Description
移动端旋转木马轮播图
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
# Swiper3d
#### 软件架构
css js
#### 使用说明
![效果](https://images.gitee.com/uploads/images/2019/1203/152715_c4215e29_2137661.png)
## 介绍
支持pc、移动端
- pc左右箭头控制
- 移动端左右滑动
## 兼容性
ie >= 10
其他主流浏览器都支持
## 使用文档:
```html
<!-- css -->
<link rel="stylesheet" href="../css/3dSwiper.css">
<!-- html -->
<div class="swiper-container">
<ul class="swiper-wrap">
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
</ul>
<ul class="swiper-dots"></ul>
<ul class="swiper-navigator">
<li class="swiper-btn-prev">&lt;</li>
<li class="swiper-btn-next">&gt;</li>
</ul>
</div>
<!-- js -->
<script src="../js/3dSwiper.js"></script>
<script>
new Swiper(".swiper-container",{
pagination: ".swiper-dots",
navigator: {
prev: ".swiper-btn-prev",
next: ".swiper-btn-next"
},
delay: 3000, // 切换的时间 默认2000
autoPlay: true // 是否自动切换 默认true
});
</script>
```
## 注意事项:
1. 图片数量要 3+
2. 图片顺序从中间开始,往右排序
3. 图片尺寸会比原来的缩小0.6倍,原来是180px,页面上会变成 `180 * 0.6 = 108px`
[在线预览地址](http://visitor009.gitee.io/swiper3d)
.swiper-container{width:100%;background:#fff;padding-bottom:10px;position:relative}.swiper-navigator{width:90%;height:30px;position:absolute;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);top:50%;left:50%}.swiper-btn-next,.swiper-btn-prev{color:#fff;background:rgba(0,0,0,.5);position:absolute;width:30px;height:30px;-ms-display:flex;display:-webkit-flex;display:flex;padding-top:3px;-ms-justify-content:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;cursor:pointer}.swiper-btn-next{right:-40px}.swiper-btn-prev{left:-40px}.swiper-wrap{width:90%;margin:0 auto;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-ms-perspective:500px;-webkit-perspective:500px;perspective:500px;display:-webkit-flex;display:flex;-ms-display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-ms-justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-ms-align-items:center;z-index:4;position:relative}.swiper-wrap li{position:absolute;left:0;height:auto;box-shadow:0 0 11px rgba(0,0,0,.5);border-radius:6%;width:auto;top:0}.swiper-wrap li:first-child{position:relative}.swiper-wrap.transition li{transition:.5s}.swiper-wrap img{width:100%;display:block}.p1{z-index:3;-webkit-transform:translateZ(100px) scale(.5);transform:translateZ(100px) scale(.5);-ms-transform:translateZ(100px) scale(.5)}.p2{z-index:2;-webkit-transform:translate3d(15%,0,90px) scale(.4);transform:translate3d(15%,0,90px) scale(.4);-ms-transform:translate3d(15%,0,90px) scale(.4)}.swiper-3 .p3,.swiper-6 .p6{z-index:2;-webkit-transform:translate3d(-15%,0,90px) scale(.4);transform:translate3d(-15%,0,90px) scale(.4);-ms-transform:translate3d(-15%,0,90px) scale(.4)}.swiper-5 .p3,.swiper-6 .p3{z-index:1;-webkit-transform:translate3d(26%,0,80px) scale(.3);transform:translate3d(26%,0,80px) scale(.3);-ms-transform:translate3d(26%,0,80px) scale(.3)}.swiper-4 .p3,.swiper-6 .p4{-webkit-transform:translateZ(80px) scale(.3);transform:translateZ(80px) scale(.3);-ms-transform:translateZ(80px) scale(.3)}.swiper-5 .p4,.swiper-6 .p5{z-index:1;-webkit-transform:translate3d(-26%,0,80px) scale(.3);transform:translate3d(-26%,0,80px) scale(.3);-ms-transform:translate3d(-26%,0,80px) scale(.3)}.swiper-4 .p4,.swiper-5 .p5,.swiper-6 .p6{z-index:2;-webkit-transform:translate3d(-15%,0,90px) scale(.4);transform:translate3d(-15%,0,90px) scale(.4);-ms-transform:translate3d(-15%,0,90px) scale(.4)}.swiper-dots{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);-ms-transform:translateX(-50%);bottom:11%;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.swiper-dots li{width:20px;height:2px;background:#b5b5b5;margin-right:10px;float:left;transition:.3s}.swiper-dots li:last-child{margin:0}.swiper-dots .active{background:#ff4949}@media screen and (min-width:425px){.swiper-navigator,.swiper-wrap{width:80%}}@media screen and (min-width:1360px){.swiper-navigator,.swiper-wrap{width:1087px}}
\ No newline at end of file
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Swiper = function Swiper(ele) {
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Swiper);
var container = document.querySelector(ele),
bannerWrap = container.querySelector('.swiper-wrap'),
btnPrev = container.querySelector('.swiper-btn-prev'),
btnNext = container.querySelector('.swiper-btn-next'),
lis = container.querySelectorAll('.swiper-wrap li'),
delay = config.delay || 2000,
autoPlay = config.autoPlay === undefined ? true : config.autoPlay,
p1 = lis[0],
p2 = lis[1],
p3 = lis[2],
p4 = lis[3],
p5 = lis[4],
p6 = lis[5],
prev = null,
next = null,
maxNum = lis.length - 1,
dots = {},
timer = 0,
dotIndex = 0,
isAddDot = false,
startP,
disX,
disY,
index;
if (lis.length < 3) {
throw "image number need 3+";
}
if (config.navigator) {
if (config.navigator.prev) {
prev = document.querySelector(config.navigator.prev);
}
if (config.navigator.next) {
next = document.querySelector(config.navigator.next);
}
}
if (lis.length > 6) {
p5 = lis[lis.length - 2];
p6 = lis[lis.length - 1];
for (var i = 0; i < lis.length; i++) {
lis[i].classList.add("p4");
}
p1.className = "p1";
p2.className = "p2";
p3.className = "p3";
p5.className = "p5";
p6.className = "p6";
bannerWrap.classList.add("swiper-6");
} else {
for (var _i = 0; _i < lis.length; _i++) {
lis[_i].classList.add('p' + (_i + 1));
}
bannerWrap.classList.add('swiper-' + lis.length);
}
// 设置点
if (config.pagination) {
var p = container.querySelector(config.pagination);
for (var _i2 = 0, len = lis.length; _i2 < len; _i2++) {
var li = document.createElement("li");
p.appendChild(li);
}
dots = p.querySelectorAll('li');
dots[0].className = "active";
}
bannerWrap.classList.add("transition");
// 图片移动,dire判断是否滑动过
function move(dire) {
var arrCls = []; // 保存类名,用来赋值
dire = dire || false;
dotIndex++;
// 得到所有类名
for (var i = 0; i < lis.length; i++) {
arrCls.push(lis[i].className);
}
// 循环赋值类名
for (var i = 0; i < lis.length; i++) {
if (dire) {
// 判断左滑
if (dire < 0) {
index = i - 1; // 得到最前面元素的上一个, 自己脑补过程
if (index < 0) {
index = maxNum;
}
} else if (dire > 0) {
// 判断右滑
index = i + 1; // 下一个
if (index > maxNum) {
index = 0;
}
if (!isAddDot) {
// 点导航下一个
dotIndex -= 2;
isAddDot = true;
}
}
}
// 如果没有参数,正常循环
if (!dire) {
index = i - 1;
if (index < 0) {
index = maxNum;
}
}
lis[i].className = arrCls[index];
}
if (dotIndex > maxNum) {
dotIndex = 0;
} else if (dotIndex < 0) {
dotIndex = maxNum;
}
isAddDot = false; // 判断是否加过
setDotActive(dotIndex);
}
function setDotActive(index) {
if (config.pagination) {
for (var i = 0; i < dots.length; i++) {
dots[i].className = '';
}
dots[index].className = 'active';
}
}
function setTimer() {
if (autoPlay) {
timer = setInterval(move, delay);
}
}
function addTransition() {
bannerWrap.classList.add('transition');
}
function removeTransition() {
bannerWrap.classList.remove('transition');
}
function picTransform(x) {
var p1 = container.querySelector('.p1'),
p2 = container.querySelector('.p2'),
p3 = container.querySelector('.p3'),
p4 = container.querySelector('.p4'),
p5 = container.querySelector('.p5'),
p6 = container.querySelector('.p6');
var percentV2 = Math.floor(p2.offsetWidth * 0.15),
// p2 的百分比转px
percentV3 = Math.floor(p3.offsetWidth * 0.26); // p3
var number = lis.length > 6 ? 6 : lis.length;
if (x < -7) {
x = -7;
} else if (x > 12) {
x = 12;
}
p1.style.transform = 'translate3d(' + x + 'px,0,100px) scale(.5)';
p2.style.transform = 'translate3d(' + (percentV2 - x) + 'px,0,90px) scale(.4)';
switch (number) {
case 3:
p3.style.transform = 'translate3d(' + (-percentV2 - x) + 'px,0,90px) scale(.4)';
break;
case 4:
p4.style.transform = 'translate3d(' + (-percentV2 - x) + 'px,0,90px) scale(.4)';
break;
case 5:
p3.style.transform = 'translate3d(' + (percentV3 - x * 2) + 'px,0,80px) scale(.3)';
p4.style.transform = 'translate3d(' + (-percentV3 - x * 4) + 'px,0,80px) scale(.3)';
p5.style.transform = 'translate3d(' + (-percentV2 - x * 2) + 'px,0,90px) scale(.4)';
break;
case 6:
p3.style.transform = 'translate3d(' + (percentV3 - x * 2) + 'px,0,80px) scale(.3)';
p4.style.transform = 'translate3d(' + x + 'px,0,80px) scale(.3)';
p5.style.transform = 'translate3d(' + (-percentV3 - x * 4) + 'px,0,80px) scale(.3)';
p6.style.transform = 'translate3d(' + (-percentV2 - x * 2) + 'px,0,90px) scale(.4)';
break;
}
}
function disabledPrev(e) {
e.preventDefault();
}
setTimer();
bannerWrap.addEventListener('touchstart', function (e) {
document.addEventListener("touchmove", disabledPrev(e), { passive: false }); // 禁止滑动后退
removeTransition();
startP = e.changedTouches[0].clientX;
clearInterval(timer);
}, false);
bannerWrap.addEventListener('touchmove', function (e) {
var movex = e.changedTouches[0].clientX;
disX = movex - startP; // 得到滑动的距离
picTransform(disX / 20); // 让图片缓慢滑动
}, false);
bannerWrap.addEventListener('touchend', function (e) {
document.removeEventListener("touchmove", disabledPrev(e), { passive: false }); // 禁止滑动后退
addTransition();
var p1 = container.querySelector('.p1'),
p2 = container.querySelector('.p2'),
p3 = container.querySelector('.p3'),
p4 = container.querySelector('.p4'),
p5 = container.querySelector('.p5'),
p6 = container.querySelector('.p6');
// 清除行内样式,否则类名的样式不生效
if (p1) {
p1.style.cssText = '';
}
if (p2) {
p2.style.cssText = '';
}
if (p3) {
p3.style.cssText = '';
}
if (p4) {
p4.style.cssText = '';
}
if (p5) {
p5.style.cssText = '';
}
if (p6) {
p6.style.cssText = '';
}
// 防止点击时也会触发
if (disX) {
move(disX);
disX = false;
}
setTimer();
}, false);
bannerWrap.addEventListener("mouseenter", function () {
clearInterval(timer);
});
btnPrev.addEventListener("mouseenter", function () {
clearInterval(timer);
});
btnNext.addEventListener("mouseenter", function () {
clearInterval(timer);
});
btnPrev.addEventListener("click", function () {
clearInterval(timer);
});
btnNext.addEventListener("click", function () {
clearInterval(timer);
});
bannerWrap.addEventListener("mouseleave", function () {
setTimer();
});
btnPrev.addEventListener("mouseleave", function () {
setTimer();
});
btnNext.addEventListener("mouseleave", function () {
setTimer();
});
if (prev) {
prev.onclick = function () {
move(1);
};
prev.onmousedown = function () {
clearInterval(timer);
};
prev.onmouseup = function () {
setTimer();
};
}
if (next) {
next.onmousedown = function () {
clearInterval(timer);
};
next.onmouseup = function () {
setTimer();
};
next.onclick = function () {
move(-1);
};
}
};
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>旋转木马</title>
<link rel="stylesheet" href="./build/css/3dSwiper.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
overflow: hidden;
}
ul {
list-style: none;
}
@media screen and (max-width: 768px){
.swiper-navigator {display: none;}
}
</style>
</head>
<body>
<div class="swiper-container ">
<ul class="swiper-wrap">
<li>
<img src="./images/3dSwiper/3dBanner1.png">
</li>
<li>
<img src="./images/3dSwiper/3dBanner2.png">
</li>
<li>
<img src="./images/3dSwiper/3dBanner3.png">
</li>
<li>
<img src="./images/3dSwiper/3dBanner4.png">
</li>
<li>
<img src="./images/3dSwiper/3dBanner5.png">
</li>
<li>
<img src="./images/3dSwiper/3dBanner6.png">
</li>
</ul>
<ul class="swiper-dots"></ul>
<ul class="swiper-navigator">
<li class="swiper-btn-prev">&lt;</li>
<li class="swiper-btn-next">&gt;</li>
</ul>
</div>
<script src="./build/js/3dSwiper.js"></script>
<script>
new Swiper(".swiper-container",{
pagination: ".swiper-dots",
navigator: {
prev: ".swiper-btn-prev",
next: ".swiper-btn-next"
},
delay: 2000,
autoPlay: true
});
</script>
<body>
</html>
\ No newline at end of file
{
"name": "swiper3d",
"version": "1.0.0",
"description": "移动端旋转木马轮播图",
"main": "Gulpfile.js",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"clean": "^4.0.2",
"del": "^5.1.0",
"delete": "^1.1.0",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.0",
"gulp-babel": "^7.0.1",
"gulp-cssnano": "^2.1.3"
},
"browserslist": [
"Android >= 4.4",
"iOS >= 7",
"> 1%",
"ie >= 10"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "gulp"
},
"repository": {
"type": "git",
"url": "https://gitee.com/visitor009/swiper3d.git"
},
"keywords": [],
"author": "",
"license": "ISC"
}
.swiper-container {
margin-top: 20%;
width: 100%;
background: none;
padding-bottom: 10px;
position: relative;
}
.swiper-navigator {
width: 90%;
height: 30px;
position: absolute;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}
.swiper-btn-next,
.swiper-btn-prev {
color: #fff;
background: rgba(0,0,0,.5);
position: absolute;
width: 30px;
height: 30px;
-ms-display: flex;
display: flex;
padding-top: 3px;
-ms-justify-content: center;
justify-content: center;
cursor: pointer;
}
.swiper-btn-next {
right: -40px;
}
.swiper-btn-prev {
left: -40px;
}
.swiper-wrap {
width: 90%;
margin: 0 auto;
/* 父元素开启3d,才会有叠加效果 f*/
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
/*ios z-index 不生效bug */
transform: translateZ(100px);
/* 叠加过渡好看点 */
-ms-perspective: 500px;
perspective: 500px;
display: flex;
-ms-display: flex;
justify-content: center;
-ms-justify-content: center;
align-items: center;
-ms-align-items: center;
z-index: 9;
position: relative;
}
.swiper-wrap li {
position: absolute;
left: 0;
height: auto;
box-shadow: 0 0 11px rgba(0, 0, 0, 0.5);
border-radius: 6%;
width: auto;
top: 0;
}
.swiper-wrap li:nth-child(1) {
position: relative;
}
.swiper-wrap.transition li {
transition: .5s;
}
.swiper-wrap img {
width: 100%;
display: block;
}
.p1 {
z-index: 3;
transform: translateZ(100px) scale(0.5);
-ms-transform: translateZ(100px) scale(0.5);
/* transform: transalteZ(10px) 数值越大越上面*/
}
.p2 {
z-index: 2;
transform: translate3d(15%, 0, 90px) scale(0.4);
-ms-transform: translate3d(15%, 0, 90px) scale(0.4);
}
.swiper-3 .p3,
.swiper-6 .p6 {
z-index: 2;
transform: translate3d(-15%, 0, 90px) scale(.4);
-ms-transform: translate3d(-15%, 0, 90px) scale(.4);
}
.swiper-6 .p3,
.swiper-5 .p3 {
z-index: 1;
transform: translate3d(26%, 0, 80px) scale(.3);
-ms-transform: translate3d(26%, 0, 80px) scale(.3);
}
.swiper-6 .p4,
.swiper-4 .p3 {
transform: translate3d(0%, 0, 80px) scale(.3);
-ms-transform: translate3d(0%, 0, 80px) scale(.3);
}
.swiper-6 .p5,
.swiper-5 .p4 {
z-index: 1;
transform: translate3d(-26%, 0, 80px) scale(0.3);
-ms-transform: translate3d(-26%, 0, 80px) scale(0.3);
}
.swiper-6 .p6,
.swiper-4 .p4,
.swiper-5 .p5 {
z-index: 2;
transform: translate3d(-15%, 0, 90px) scale(.4);
-ms-transform: translate3d(-15%, 0, 90px) scale(.4);
}
.swiper-dots {
position: absolute;
left: 50%;
transform: translateX(-50%);
-ms-transform: translateX(-50%);
bottom: 11%;
display: flex;
justify-content: center;
}
.swiper-dots li {
width: 20px;
height: 2px;
background: #b5b5b5;
margin-right: 10px;
float: left;
transition: .3s;
}
.swiper-dots li:last-child {
margin: 0;
}
.swiper-dots .active {
background: #ff4949;
}
@media screen and (min-width: 425px) {
.swiper-wrap,
.swiper-navigator {
width: 80%;
}
}
@media screen and (min-width: 1360px) {
.swiper-wrap,
.swiper-navigator {
width: 1087px;
}
}
class Swiper {
constructor(ele, config = {}) {
var container = document.querySelector(ele),
bannerWrap = container.querySelector('.swiper-wrap'),
btnPrev = container.querySelector('.swiper-btn-prev'),
btnNext = container.querySelector('.swiper-btn-next'),
lis = container.querySelectorAll('.swiper-wrap li'),
delay = config.delay || 2000,
autoPlay = config.autoPlay === undefined ? true : config.autoPlay,
p1 = lis[0],
p2 = lis[1],
p3 = lis[2],
p4 = lis[3],
p5 = lis[4],
p6 = lis[5],
prev = null,
next = null,
maxNum = lis.length - 1,
dots = {},
timer = 0,
dotIndex = 0,
isAddDot = false,
startP, disX, disY, index;
if (lis.length < 3) {
throw ("image number need 3+");
}
if (config.navigator) {
if (config.navigator.prev) {
prev = document.querySelector(config.navigator.prev);
}
if (config.navigator.next) {
next = document.querySelector(config.navigator.next);
}
}
if (lis.length > 6) {
p5 = lis[lis.length-2];
p6 = lis[lis.length-1];
for (let i=0; i<lis.length; i++) {
lis[i].classList.add("p4");
}
p1.className = "p1";
p2.className = "p2";
p3.className = "p3";
p5.className = "p5";
p6.className = "p6";
bannerWrap.classList.add("swiper-6");
} else {
for (let i=0; i<lis.length; i++) {
lis[i].classList.add(`p${i+1}`);
}
bannerWrap.classList.add(`swiper-${lis.length}`);
}
// 设置点
if (config.pagination) {
let p = container.querySelector(config.pagination);
for (let i = 0, len = lis.length; i < len; i++) {
let li = document.createElement("li");
p.appendChild(li);
}
dots = p.querySelectorAll('li');
dots[0].className = "active";
}
bannerWrap.classList.add("transition");
// 图片移动,dire判断是否滑动过
function move(dire) {
var arrCls = []; // 保存类名,用来赋值
dire = dire || false;
dotIndex++;
// 得到所有类名
for (var i = 0; i < lis.length; i++) {
arrCls.push(lis[i].className);
}
// 循环赋值类名
for (var i = 0; i < lis.length; i++) {
if (dire) {
// 判断左滑
if (dire < 0) {
index = i - 1; // 得到最前面元素的上一个, 自己脑补过程
if (index < 0) {
index = maxNum;
}
} else if (dire > 0) { // 判断右滑
index = i + 1; // 下一个
if (index > maxNum) {
index = 0;
}
if (!isAddDot) { // 点导航下一个
dotIndex -= 2;
isAddDot = true;
}
}
}
// 如果没有参数,正常循环
if (!dire) {
index = i - 1;
if (index < 0) {
index = maxNum;
}
}
lis[i].className = arrCls[index];
}
if (dotIndex > maxNum) {
dotIndex = 0;
} else if (dotIndex < 0) {
dotIndex = maxNum;
}
isAddDot = false; // 判断是否加过
setDotActive(dotIndex);
}
function setDotActive(index) {
if (config.pagination) {
for (var i = 0; i < dots.length; i++) {
dots[i].className = '';
}
dots[index].className = 'active';
}
}
function setTimer() {
if (autoPlay) {
timer = setInterval(move, delay);
}
}
function addTransition() {
bannerWrap.classList.add('transition');
}
function removeTransition() {
bannerWrap.classList.remove('transition');
}
function picTransform(x) {
var p1 = container.querySelector('.p1'),
p2 = container.querySelector('.p2'),
p3 = container.querySelector('.p3'),
p4 = container.querySelector('.p4'),
p5 = container.querySelector('.p5'),
p6 = container.querySelector('.p6');
var percentV2 = Math.floor(p2.offsetWidth * 0.15), // p2 的百分比转px
percentV3 = Math.floor(p3.offsetWidth * 0.26); // p3
var number = lis.length > 6 ? 6 : lis.length;
if (x < -7) {
x = -7;
} else if (x > 12) {
x = 12
}
p1.style.transform = 'translate3d(' + x + 'px,0,100px) scale(.5)';
p2.style.transform = 'translate3d(' + (percentV2 - x) + 'px,0,90px) scale(.4)';
switch (number) {
case 3:
p3.style.transform = 'translate3d(' + (-percentV2 - x) + 'px,0,90px) scale(.4)';
break;
case 4:
p4.style.transform = 'translate3d(' + (-percentV2 - x) + 'px,0,90px) scale(.4)';
break;
case 5:
p3.style.transform = 'translate3d(' + (percentV3 - (x * 2)) + 'px,0,80px) scale(.3)';
p4.style.transform = 'translate3d(' + (-percentV3 - (x * 4)) + 'px,0,80px) scale(.3)';
p5.style.transform = 'translate3d(' + (-percentV2 - (x * 2)) + 'px,0,90px) scale(.4)';
break;
case 6:
p3.style.transform = 'translate3d(' + (percentV3 - (x * 2)) + 'px,0,80px) scale(.3)';
p4.style.transform = 'translate3d(' + x + 'px,0,80px) scale(.3)';
p5.style.transform = 'translate3d(' + (-percentV3 - (x * 4)) + 'px,0,80px) scale(.3)';
p6.style.transform = 'translate3d(' + (-percentV2 - (x * 2)) + 'px,0,90px) scale(.4)';
break;
}
}
function disabledPrev(e) {
e.preventDefault();
}
setTimer()
bannerWrap.addEventListener('touchstart', function (e) {
document.addEventListener("touchmove",disabledPrev(e),{passive:false}); // 禁止滑动后退
removeTransition();
startP = e.changedTouches[0].clientX;
clearInterval(timer);
}, false);
bannerWrap.addEventListener('touchmove', function (e) {
var movex = e.changedTouches[0].clientX;
disX = movex - startP; // 得到滑动的距离
picTransform(disX / 20); // 让图片缓慢滑动
}, false);
bannerWrap.addEventListener('touchend', function (e) {
document.removeEventListener("touchmove",disabledPrev(e),{passive:false}); // 禁止滑动后退
addTransition();
var p1 = container.querySelector('.p1'),
p2 = container.querySelector('.p2'),
p3 = container.querySelector('.p3'),
p4 = container.querySelector('.p4'),
p5 = container.querySelector('.p5'),
p6 = container.querySelector('.p6');
// 清除行内样式,否则类名的样式不生效
if (p1) { p1.style.cssText = ''; }
if (p2) { p2.style.cssText = ''; }
if (p3) { p3.style.cssText = ''; }
if (p4) { p4.style.cssText = ''; }
if (p5) { p5.style.cssText = ''; }
if (p6) { p6.style.cssText = ''; }
// 防止点击时也会触发
if (disX) {
move(disX);
disX = false;
}
setTimer()
}, false);
bannerWrap.addEventListener("mouseenter",function() {
clearInterval(timer);
});
btnPrev.addEventListener("mouseenter",function() {
clearInterval(timer);
});
btnNext.addEventListener("mouseenter",function() {
clearInterval(timer);
});
btnPrev.addEventListener("click",function() {
clearInterval(timer);
});
btnNext.addEventListener("click",function() {
clearInterval(timer);
});
bannerWrap.addEventListener("mouseleave",function() {
setTimer()
});
btnPrev.addEventListener("mouseleave",function() {
setTimer()
});
btnNext.addEventListener("mouseleave",function() {
setTimer()
});
if (prev) {
prev.onclick = function() {
move(1);
};
prev.onmousedown = function() {
clearInterval(timer);
}
prev.onmouseup = function() {
setTimer()
}
}
if (next) {
next.onmousedown = function() {
clearInterval(timer);
}
next.onmouseup = function() {
setTimer()
}
next.onclick = function() {
move(-1);
};
}
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@
background-size: cover;
background-repeat: no-repeat;
background-position: bottom center;
padding-bottom: 0.7rem;
padding-bottom: 1.14rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
......@@ -75,6 +75,7 @@
overflow: hidden;
}
.nav-item__mtitle{
margin-top: 0.1rem;
text-align: center;
font-size: 0.26rem;
line-height: 0.28rem;
......@@ -96,18 +97,23 @@
height: 0.6rem;
}
.thumb{
padding: 25px 0 30px;
padding: 0.45rem 0 0.54rem;
text-align: center;
}
.thumb__img{
width: 6.68rem;
height: 4.46rem;
vertical-align: top;
}
.content{
width: 6.47rem;
margin: 0 auto;
flex:1;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
.content::-webkit-scrollbar{
display: none;
}
.content__text{
font-size: 0.3rem;
......@@ -116,7 +122,7 @@
}
.bottom{
height: 0.7rem;
height: 1.14rem;
position: fixed;
left: 0;
bottom:0;
......
......@@ -553,6 +553,7 @@
);
);
);
js(showSwiper());
</action>
......
<!DOCTYPE html>
<html>
<head>
<title>度假到丹寨</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<style>
@-ms-viewport { width:device-width; }
@media only screen and (min-device-width:800px) { html { overflow:hidden; } }
html { height:100%; }
body { height:100%; overflow:hidden; margin:0; padding:0; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#FFFFFF; background-color:#000000; }
</style>
<title>度假到丹寨</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
<link rel="stylesheet" href="/libs/swiper3d/src/css/3dSwiper.css">
<style>
@-ms-viewport {
width: device-width;
}
@media only screen and (min-device-width: 800px) {
html {
overflow: hidden;
}
}
html {
height: 100%;
}
body {
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #FFFFFF;
background-color: #000000;
}
#swiper{
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
ul,li {
list-style: none;
}
@media screen and (max-width: 768px){
.swiper-navigator {display: none;}
}
.swiper-dots{
visibility: hidden;
}
.swiper-navigator{
visibility: hidden;
}
</style>
</head>
<body>
<div id="pano" style="width:100%;height:100%;"></div>
<div id="swiper" style="width:100%;height:100%;">
<div class="swiper-container ">
<ul class="swiper-wrap">
<li>
<img src="/images/slide/0.png">
</li>
<li>
<img src="/images/slide/5.jpg">
</li>
<li>
<img src="/images/slide/6.jpg">
</li>
<li>
<img src="/images/slide/7.jpg">
</li>
<li>
<img src="/images/slide/8.jpg">
</li>
<li>
<img src="/images/slide/9.jpg">
</li>
<li>
<img src="/images/slide/10.jpg">
</li>
</ul>
<!-- <ul class="swiper-wrap">-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner1.png">-->
<!-- </li>-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner2.png">-->
<!-- </li>-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner3.png">-->
<!-- </li>-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner4.png">-->
<!-- </li>-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner5.png">-->
<!-- </li>-->
<!-- <li>-->
<!-- <img src="/libs/swiper3d/images/3dSwiper/3dBanner6.png">-->
<!-- </li>-->
<!-- </ul>-->
<ul class="swiper-dots"></ul>
<ul class="swiper-navigator">
<li class="swiper-btn-prev">&lt;</li>
<li class="swiper-btn-next">&gt;</li>
</ul>
</div>
</div>
<script src="/libs/swiper3d/src/js/3dSwiper.js"></script>
<script>
new Swiper(".swiper-container",{
pagination: ".swiper-dots",
navigator: {
prev: ".swiper-btn-prev",
next: ".swiper-btn-next"
},
delay: 4000,
autoPlay: true
});
</script>
<script src="tour.js"></script>
<script>
embedpano({
swf: "tour.swf",
xml: "tour.xml",
target: "pano",
html5: "auto",
mobilescale: 1.0,
passQueryParameters: true,
onready: krpano_onready_callback
});
<div id="pano" style="width:100%;height:100%;">
<noscript><table style="width:100%;height:100%;"><tr style="vertical-align:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript>
<script>
embedpano({swf:"tour.swf", xml:"tour.xml", target:"pano", html5:"auto", mobilescale:1.0, passQueryParameters:true,onready : krpano_onready_callback});
function krpano_onready_callback(krpano_interface)
{
krpano = krpano_interface;
setTimeout(()=>{
add_hotspot('完善的设施',128.862,4.478)
add_hotspot('宜人的气候','-144.129',-5)
},1000)
// setTimeout(()=>{
//
//
// },3000)
}
function showSwiper() {
setTimeout(()=>{
console.log('showSwiper')
document.getElementById('swiper').style.zIndex = 4
},5000)
}
function krpano_onready_callback(krpano_interface) {
krpano = krpano_interface;
setTimeout(() => {
add_hotspot('完善的设施', 128.862, 4.478)
add_hotspot('宜人的气候', '-144.129', -5)
}, 1000)
// setTimeout(()=>{
//
//
// },3000)
}
/**
* 图片热点创建
* @param hs_name
* @param ath
* @param atv
*/
function add_hotspot(hs_name,ath,atv)
{
if (krpano) {
var h = ath//krpano.get("view.hlookat");
var v = atv//krpano.get("view.vlookat");
//var hs_name = //"hs" + ((Date.now() + Math.random()) | 0); // create unique/randome name
console.log(hs_name,h,v)
krpano.call("addhotspot(" + hs_name + ")");
krpano.set("hotspot["+hs_name+"].url", "/images/pano/diy_hotspot.png");
krpano.set("hotspot["+hs_name+"].ath", h);
krpano.set("hotspot["+hs_name+"].atv", v);
// krpano.set("hotspot["+hs_name+"].zorder", '42');
krpano.set("hotspot["+hs_name+"].distorted", true);
if ( krpano.get("device.html5") ) {
// for HTML5 it's possible to assign JS functions directly to krpano events
krpano.set("hotspot["+hs_name+"].onclick", function(hs) {
console.log('hotspot "' + hs + '" clicked');
if(hs==='完善的设施'){
location.href='/show.html'
}
if(hs==='宜人的气候'){
location.href='/show.html'
}
}.bind(null, hs_name));
}
else {
// for Flash the js() action need to be used to call from Flash to JS (this code would work for Flash and HTML5)
krpano.set("hotspot["+hs_name+"].onclick", "js( alert(calc('hotspot \"' + name + '\" clicked')) );");
}
}
/**
* 图片热点创建
* @param hs_name
* @param ath
* @param atv
*/
function add_hotspot(hs_name, ath, atv) {
if (krpano) {
var h = ath//krpano.get("view.hlookat");
var v = atv//krpano.get("view.vlookat");
//var hs_name = //"hs" + ((Date.now() + Math.random()) | 0); // create unique/randome name
console.log(hs_name, h, v)
krpano.call("addhotspot(" + hs_name + ")");
krpano.set("hotspot[" + hs_name + "].url", "/images/pano/diy_hotspot.png");
krpano.set("hotspot[" + hs_name + "].ath", h);
krpano.set("hotspot[" + hs_name + "].atv", v);
// krpano.set("hotspot["+hs_name+"].zorder", '42');
krpano.set("hotspot[" + hs_name + "].distorted", true);
if (krpano.get("device.html5")) {
// for HTML5 it's possible to assign JS functions directly to krpano events
krpano.set("hotspot[" + hs_name + "].onclick", function (hs) {
console.log('hotspot "' + hs + '" clicked');
// if(hs==='完善的设施'){
// location.href='/feature.html'
// }
// if(hs==='宜人的气候'){
// location.href='/feature.html'
// }
}.bind(null, hs_name));
} else {
// for Flash the js() action need to be used to call from Flash to JS (this code would work for Flash and HTML5)
// krpano.set("hotspot["+hs_name+"].onclick", "js( alert(calc('hotspot \"' + name + '\" clicked')) );");
}
}
}
window.func = function(){
window.func = function () {
console.log(3333333333)
}
function test(hs)
{
if(hs==='完善的设施'){
location.href='/show.html'
}
if(hs==='宜人的气候'){
location.href='/show.html'
}
function test(hs) {
// if(hs==='完善的设施'){
// location.href='/feature.html'
// }
// if(hs==='宜人的气候'){
// location.href='/feature.html'
// }
}
</script>
</script>
</div>
</body>
......
......@@ -90,9 +90,44 @@
<cube url="panos/vr.tiles/pano_%s.jpg" />
</image>
<layer name="mask"
type="container"
keep="true"
parent=""
visible="true"
enabled="true"
handcursor="true"
maskchildren="false"
scalechildren="false"
zorder="1"
style=""
align=""
edge=""
x=""
y=""
rotate="0.0"
width="100%"
height="100%"
scale="1.0"
alpha="1.0"
crop=""
onovercrop=""
ondowncrop=""
bgcolor="0x000000"
bgalpha="0.1"
bgborder="0"
bgroundedge="0"
bgshadow=""
bgcapture="true"
onover.addevent=""
onhover.addevent=""
onout.addevent=""
onclick.addevent=""
ondown.addevent=""
onup.addevent=""
onloaded.addevent=""
/>
<!-- 文字热点-->
<hotspot name="mytext"
type="text"
ath="-144.129" atv="-8" edge="center"
......@@ -122,7 +157,7 @@
type="text"
ath="128.862" atv="0" edge="center"
distorted="true"
zorder="5"
zorder="3"
renderer="webgl"
html="完善的设施"
css="font-family:Arial; font-size:16px; color:#FFFFFF;"
......@@ -142,19 +177,8 @@
onautosized=""
onclick="bindJsEvent('完善的设施')"
/>
<!-- 蒙层-->
</scene>
<layer name="mask"
type="container"
keep="true"
visible="true"
enabled="false"
zorder="-99999"
width="100%"
height="100%"
bgcolor="0x000000"
bgalpha="0.15"
/>
</krpano>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment