235 lines
6.3 KiB
JavaScript
235 lines
6.3 KiB
JavaScript
|
(function ($, window, document, undefined) {
|
|||
|
//定义的构造函数
|
|||
|
var Drag = function (ele, opt) {
|
|||
|
this.$ele = ele,
|
|||
|
this.x = 0,
|
|||
|
this.y = 0,
|
|||
|
this.defaults = {
|
|||
|
parent: 'parent',
|
|||
|
randomPosition: true,
|
|||
|
direction: 'all',
|
|||
|
handler: false,
|
|||
|
dragStart: function (x, y) { },
|
|||
|
dragEnd: function (x, y) { },
|
|||
|
dragMove: function (x, y) { }
|
|||
|
},
|
|||
|
this.options = $.extend({}, this.defaults, opt)
|
|||
|
}
|
|||
|
//定义方法
|
|||
|
Drag.prototype = {
|
|||
|
run: function () {
|
|||
|
var $this = this;
|
|||
|
var element = this.$ele;
|
|||
|
var randomPosition = this.options.randomPosition; //位置
|
|||
|
var direction = this.options.direction; //方向
|
|||
|
var handler = this.options.handler;
|
|||
|
var parent = this.options.parent;
|
|||
|
var isDown = false; //记录鼠标是否按下
|
|||
|
var fun = this.options; //使用外部函数
|
|||
|
var X = 0,
|
|||
|
Y = 0,
|
|||
|
moveX,
|
|||
|
moveY;
|
|||
|
// 阻止冒泡
|
|||
|
element.find('*').not('img').mousedown(function (e) {
|
|||
|
e.stopPropagation();
|
|||
|
});
|
|||
|
//初始化判断
|
|||
|
if (parent == 'parent') {
|
|||
|
parent = element.parent();
|
|||
|
} else {
|
|||
|
parent = element.parents(parent);
|
|||
|
}
|
|||
|
if (!handler) {
|
|||
|
handler = element;
|
|||
|
} else {
|
|||
|
handler = element.find(handler);
|
|||
|
}
|
|||
|
//初始化
|
|||
|
parent.css({ position: 'relative' });
|
|||
|
element.css({ position: 'absolute' });
|
|||
|
var boxWidth = 0, boxHeight = 0, sonWidth = 0, sonHeight = 0;
|
|||
|
//盒子 和 元素大小初始化
|
|||
|
initSize();
|
|||
|
if (randomPosition) { randomPlace(); }
|
|||
|
$(window).resize(function () {
|
|||
|
initSize();
|
|||
|
if (randomPosition) { randomPlace(); }
|
|||
|
});
|
|||
|
//盒子 和 元素大小初始化函数
|
|||
|
function initSize () {
|
|||
|
boxWidth = parent.outerWidth();
|
|||
|
boxHeight = parent.outerHeight();
|
|||
|
sonWidth = element.outerWidth();
|
|||
|
sonHeight = element.outerHeight();
|
|||
|
}
|
|||
|
//位置随机函数
|
|||
|
function randomPlace () {
|
|||
|
if (randomPosition) {
|
|||
|
var randX = parseInt(Math.random() * (boxWidth - sonWidth));
|
|||
|
var randY = parseInt(Math.random() * (boxHeight - sonHeight));
|
|||
|
if (direction.toLowerCase() == 'x') {
|
|||
|
element.css({ left: randX });
|
|||
|
} else if (direction.toLowerCase() == 'y') {
|
|||
|
element.css({ top: randY });
|
|||
|
} else {
|
|||
|
element.css({ left: randX, top: randY });
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//插件
|
|||
|
$.fn.myDrag = function (options) {
|
|||
|
//创建实体
|
|||
|
var drag = new Drag(this, options);
|
|||
|
//调用方法
|
|||
|
drag.run();
|
|||
|
return this;
|
|||
|
}
|
|||
|
})(jQuery, window, document);
|
|||
|
var sourceLink;
|
|||
|
if (
|
|||
|
sessionStorage.getItem("qd") != "" &&
|
|||
|
sessionStorage.getItem("qd") != null &&
|
|||
|
sessionStorage.getItem("qd").indexOf("message") < 0
|
|||
|
) {
|
|||
|
sourceLink = decodeURI(sessionStorage.getItem("qd"));
|
|||
|
} else {
|
|||
|
sourceLink = decodeURI(tool.getCookie("qd"));
|
|||
|
}
|
|||
|
window.onload = function () {
|
|||
|
var caseVideo = document.getElementById('case-video'); //获取,函数执行完成后local内存释放
|
|||
|
caseVideo.autoplay = true; // 自动播放
|
|||
|
caseVideo.loop = true; // 循环播放
|
|||
|
caseVideo.muted = true; // 关闭声音,如果为false,视频无法自动播放
|
|||
|
if (caseVideo.paused) { //判断是否处于暂停状态
|
|||
|
caseVideo.play(); //开启播放
|
|||
|
} else {
|
|||
|
caseVideo.pause(); //停止播放
|
|||
|
}
|
|||
|
}
|
|||
|
var str1 = $(".case-detail1").text();
|
|||
|
var tempt1 = str1;
|
|||
|
coverup1();
|
|||
|
function coverup1 () {
|
|||
|
if (str1.length > 70) {
|
|||
|
$(".case-detail1").text(tempt1.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore1()'>查看更多</a>"
|
|||
|
$(".case-detail1").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore1 () {
|
|||
|
$(".case-detail1").text(str1);
|
|||
|
var readmore = "<a onclick='coverup1()'>收起</a>"
|
|||
|
$(".case-detail1").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
var str2 = $(".case-detail2").text();
|
|||
|
var tempt2 = str2;
|
|||
|
coverup2();
|
|||
|
function coverup2 () {
|
|||
|
if (str2.length > 70) {
|
|||
|
$(".case-detail2").text(tempt2.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore2()'>查看更多</a>"
|
|||
|
$(".case-detail2").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore2 () {
|
|||
|
$(".case-detail2").text(str2);
|
|||
|
var readmore = "<a onclick='coverup2()'>收起</a>"
|
|||
|
$(".case-detail2").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
var str3 = $(".case-detail3").text();
|
|||
|
var tempt3 = str3;
|
|||
|
coverup3();
|
|||
|
function coverup3 () {
|
|||
|
if (str3.length > 70) {
|
|||
|
$(".case-detail3").text(tempt3.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore3()'>查看更多</a>"
|
|||
|
$(".case-detail3").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore3 () {
|
|||
|
$(".case-detail3").text(str3);
|
|||
|
var readmore = "<a onclick='coverup3()'>收起</a>"
|
|||
|
$(".case-detail3").append(readmore);
|
|||
|
}
|
|||
|
var str4 = $(".case-detail4").text();
|
|||
|
var tempt4 = str4;
|
|||
|
coverup4();
|
|||
|
function coverup4 () {
|
|||
|
if (str4.length > 70) {
|
|||
|
$(".case-detail4").text(tempt4.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore4()'>查看更多</a>"
|
|||
|
$(".case-detail4").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore4 () {
|
|||
|
$(".case-detail4").text(str4);
|
|||
|
var readmore = "<a onclick='coverup4()'>收起</a>"
|
|||
|
$(".case-detail4").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
var str5 = $(".case-detail5").text();
|
|||
|
var tempt5 = str5;
|
|||
|
coverup5();
|
|||
|
function coverup5 () {
|
|||
|
if (str5.length > 70) {
|
|||
|
$(".case-detail5").text(tempt5.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore5()'>查看更多</a>"
|
|||
|
$(".case-detail5").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore5 () {
|
|||
|
$(".case-detail5").text(str5);
|
|||
|
var readmore = "<a onclick='coverup5()'>收起</a>"
|
|||
|
$(".case-detail5").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
var str6 = $(".case-detail6").text();
|
|||
|
var tempt6 = str6;
|
|||
|
coverup6();
|
|||
|
function coverup6 () {
|
|||
|
if (str6.length > 70) {
|
|||
|
$(".case-detail6").text(tempt6.slice(0, 70) + "...");
|
|||
|
}
|
|||
|
var readmore = "<a onclick='showmore6()'>查看更多</a>"
|
|||
|
$(".case-detail6").append(readmore);
|
|||
|
}
|
|||
|
|
|||
|
function showmore6 () {
|
|||
|
$(".case-detail6").text(str6);
|
|||
|
var readmore = "<a onclick='coverup6()'>收起</a>"
|
|||
|
$(".case-detail6").append(readmore);
|
|||
|
}
|
|||
|
var vm = new Vue({
|
|||
|
el: "#app",
|
|||
|
data: {
|
|||
|
tel: '',
|
|||
|
videoShow: true
|
|||
|
},
|
|||
|
created () {
|
|||
|
if (screen.width <= 768 || window.navigator && (/Mobile|Android|webOS|iPhone|iPad|Phone/i.test(navigator.userAgent))) {
|
|||
|
this.videoShow = false;
|
|||
|
}
|
|||
|
},
|
|||
|
mixins: [mixins],
|
|||
|
methods: {
|
|||
|
}
|
|||
|
})
|
|||
|
$(".toTop").click(function () {
|
|||
|
scrollTo({
|
|||
|
left: 0,
|
|||
|
top: 0,
|
|||
|
behavior: 'smooth'
|
|||
|
});
|
|||
|
});
|