压缩图片
This commit is contained in:
7
assets_backup/js/bootstrap.min.js
vendored
Normal file
7
assets_backup/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
assets_backup/js/d3.min.js
vendored
Normal file
2
assets_backup/js/d3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
112
assets_backup/js/history.js
Normal file
112
assets_backup/js/history.js
Normal file
@@ -0,0 +1,112 @@
|
||||
(function(e){
|
||||
function b(a){
|
||||
a=a.replace(/left|top/g,"0px");
|
||||
a=a.replace(/right|bottom/g,"100%");
|
||||
a=a.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
|
||||
a=a.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
|
||||
return[parseFloat(a[1],10),a[2],parseFloat(a[3],10),a[4]]}
|
||||
if(!document.defaultView||!document.defaultView.getComputedStyle){
|
||||
var f=e.curCSS;
|
||||
e.curCSS=function(a,c,b){
|
||||
"background-position"===c&&(c="backgroundPosition");
|
||||
if("backgroundPosition"!==c||!a.currentStyle||a.currentStyle[c])
|
||||
return f.apply(this, arguments);
|
||||
var g=a.style;
|
||||
return!b&&g&&g[c]?g[c]:f(a,"backgroundPositionX",b)+" "+f(a,"backgroundPositionY",b)
|
||||
}
|
||||
}
|
||||
var d=e.fn.animate;
|
||||
e.fn.animate=function(a){
|
||||
"background-position"in a&&(a.backgroundPosition=a["background-position"],delete a["background-position"]);
|
||||
"backgroundPosition"in a&&(a.backgroundPosition="("+a.backgroundPosition);
|
||||
return d.apply(this,arguments)
|
||||
};
|
||||
e.fx.step.backgroundPosition=function(a){
|
||||
if(!a.bgPosReady){
|
||||
var c=e.curCSS(a.elem,"backgroundPosition");
|
||||
c||(c="0px 0px");c=b(c);a.start= [c[0],c[2]];
|
||||
c=b(a.end);
|
||||
a.end=[c[0],c[2]];
|
||||
a.unit=[c[1],c[3]];
|
||||
a.bgPosReady=!0}c=[];
|
||||
c[0]=(a.end[0]-a.start[0])*a.pos+a.start[0]+a.unit[0];
|
||||
c[1]=(a.end[1]-a.start[1])*a.pos+a.start[1]+a.unit[1];
|
||||
a.elem.style.backgroundPosition=c[0]+" "+c[1]
|
||||
}
|
||||
}
|
||||
)(jQuery);
|
||||
|
||||
(function(e){e.extend(e.fx.step,{
|
||||
backgroundPosition:function(b){
|
||||
function f(a){
|
||||
a=a.replace(/left|top/g,"0px");
|
||||
a=a.replace(/right|bottom/g,"100%");
|
||||
a=a.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
|
||||
a=a.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
|
||||
return[parseFloat(a[1],10),a[2],parseFloat(a[3],10),a[4]]
|
||||
}
|
||||
if(0===b.state&&"string"==typeof b.end){
|
||||
var d=e.curCSS(b.elem,"backgroundPosition"),d=f(d);
|
||||
b.start=[d[0],d[2]];d=f(b.end);b.end=[d[0],d[2]];
|
||||
b.unit=[d[1],d[3]]}d=[];
|
||||
d[0]=(b.end[0]-b.start[0])* b.pos+b.start[0]+b.unit[0];
|
||||
d[1]=(b.end[1]-b.start[1])*b.pos+b.start[1]+b.unit[1];
|
||||
b.elem.style.backgroundPosition=d[0]+" "+d[1]
|
||||
}
|
||||
}
|
||||
)})(jQuery);
|
||||
|
||||
$(function(){
|
||||
function e(){
|
||||
c=$(".list li").eq(d).find(".year").html();
|
||||
$(".timeblock").attr("thisyear",c);
|
||||
var a=c.split(""),b=["numf","nums","numt","numfo"];
|
||||
for(i=0;4>i;i++)
|
||||
$("."+b[i]+"").stop(!0,!1).animate({backgroundPosition:"0px "+-24*a[i]},{duration:200})}
|
||||
$(".list .liwrap").mouseover(function(){
|
||||
$(".list li").removeClass("thiscur");
|
||||
$(this).parent().addClass("thiscur")
|
||||
});
|
||||
var b=0,f=$(".list li").length,d=0,a=!0,c;
|
||||
(function(){
|
||||
var a=$(window).height();
|
||||
890<=a&&(row=6);
|
||||
800<=a&&890>a&&(row=5);
|
||||
726<=a&& 800>a&&(row=4);
|
||||
726>a&&(row=3)}
|
||||
)();
|
||||
var h=f-row;
|
||||
$(".list").height(110*row);
|
||||
$("#content").height(110*row+25);
|
||||
$.fn.liOut=function(){
|
||||
$(this).find(".lileft").animate({left:"-400px"},500,"easeOutQuart");
|
||||
$(this).find(".liright").animate({right:"-700px"},500,"easeOutQuart")
|
||||
};
|
||||
$.fn.liIn=function(){
|
||||
$(this).find(".lileft").animate({left:"0px"},500,"easeOutQuart");
|
||||
$(this).find(".liright").animate({right:"0px"},500,"easeOutQuart")
|
||||
};
|
||||
$(".arrowdown").click(function(){
|
||||
a&&parseInt($(".list li:first").css("marginTop"))> -110*h&&(d++,b--,a=!1,$(".list li").eq(d-1).liOut(),$(".list li").eq(d+row-1).liIn(),$(".list li:first").animate({marginTop:110*b},600,"easeInOutQuad",function(){
|
||||
a=!0;$(".arrowdown").css("opacity",1);
|
||||
$(".arrowdown").removeClass("arrow_active")
|
||||
}),e()
|
||||
)});
|
||||
$(".arrowup").click(function(){
|
||||
a&&0!=parseInt($(".list li:first").css("marginTop"))&&(b++,d--,a=!1,$(".list li").eq(d).liIn(),$(".list li").eq(d+row).liOut(),$(".list li:first").animate({marginTop:110*b},600,"easeInOutQuad",function(){
|
||||
a=!0;$(".arrowup").css("opacity", 1);
|
||||
$(".arrowup").removeClass("arrow_active")
|
||||
}),e()
|
||||
)});
|
||||
$(".list").mousewheel(function(b,c){
|
||||
Math.abs(c);
|
||||
if(a){
|
||||
var d=parseInt($(".list li:first").css("marginTop"));
|
||||
0<c?0!=d&&($(".arrowup").addClass("arrow_active"),$(".arrowup").trigger("click")):d>-110*h&&($(".arrowdown").addClass("arrow_active"),$(".arrowdown").trigger("click"))
|
||||
}
|
||||
});
|
||||
$(".timeblock").attr("thisyear",c);
|
||||
$(".list li:gt("+(row-1)+")").find(".lileft").css({left:"-400px"});
|
||||
$(".list li:gt("+(row-1)+")").find(".liright").css({right:"-700px"});
|
||||
|
||||
});
|
||||
4
assets_backup/js/html5shiv.min.js
vendored
Normal file
4
assets_backup/js/html5shiv.min.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
|
||||
10337
assets_backup/js/jquery-1.11.0.js
vendored
Normal file
10337
assets_backup/js/jquery-1.11.0.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
208
assets_backup/js/jquery-plugin-collection.js
vendored
Normal file
208
assets_backup/js/jquery-plugin-collection.js
vendored
Normal file
File diff suppressed because one or more lines are too long
44
assets_backup/js/jquery.easing.js
Normal file
44
assets_backup/js/jquery.easing.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
* Uses the built in easing capabilities added In jQuery 1.1
|
||||
* to offer multiple easing options
|
||||
*
|
||||
* TERMS OF USE - EASING EQUATIONS
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2001 Robert Penner
|
||||
* All rights reserved.
|
||||
*
|
||||
* TERMS OF USE - jQuery Easing
|
||||
*
|
||||
* Open source under the BSD License.
|
||||
*
|
||||
* Copyright © 2008 George McGinley Smith
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});
|
||||
12
assets_backup/js/jquery.mousewheel.js
Normal file
12
assets_backup/js/jquery.mousewheel.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
(function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,f=!0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,c.axis!==undefined&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),c.wheelDeltaY!==undefined&&(h=c.wheelDeltaY/120),c.wheelDeltaX!==undefined&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery)
|
||||
58
assets_backup/js/kefu.js
Normal file
58
assets_backup/js/kefu.js
Normal file
File diff suppressed because one or more lines are too long
445
assets_backup/js/map3d.js
Normal file
445
assets_backup/js/map3d.js
Normal file
@@ -0,0 +1,445 @@
|
||||
/**
|
||||
* 3D 地图模块 - 懒加载版本
|
||||
* 通过 IntersectionObserver 触发加载,避免阻塞首屏渲染
|
||||
*/
|
||||
|
||||
let mapInitialized = false;
|
||||
|
||||
async function initMap3D(geoDataPromise = null, threeJSPromise = null) {
|
||||
if (mapInitialized) return;
|
||||
mapInitialized = true;
|
||||
|
||||
const container = document.getElementById("map");
|
||||
if (!container) return;
|
||||
|
||||
// 使用预加载的模块或动态导入
|
||||
const threeModule = threeJSPromise
|
||||
? (await threeJSPromise) ? (await import('https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js')) : null
|
||||
: await import('https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js');
|
||||
|
||||
const THREE = threeModule.default || threeModule;
|
||||
|
||||
const [
|
||||
{ OrbitControls },
|
||||
{ CSS2DRenderer, CSS2DObject },
|
||||
{ Line2 },
|
||||
{ LineMaterial },
|
||||
{ LineGeometry }
|
||||
] = threeJSPromise && (await threeJSPromise)
|
||||
? [
|
||||
await import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/controls/OrbitControls.js'),
|
||||
await import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/renderers/CSS2DRenderer.js'),
|
||||
await import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/Line2.js'),
|
||||
await import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineMaterial.js'),
|
||||
await import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineGeometry.js')
|
||||
]
|
||||
: await Promise.all([
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/controls/OrbitControls.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/renderers/CSS2DRenderer.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/Line2.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineMaterial.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineGeometry.js')
|
||||
]);
|
||||
|
||||
const scene = new THREE.Scene();
|
||||
|
||||
const ambientLight = new THREE.AmbientLight(0xd4e7fd, 4);
|
||||
scene.add(ambientLight);
|
||||
const directionalLight = new THREE.DirectionalLight(0xe8eaeb, 0.2);
|
||||
directionalLight.position.set(0, 10, 5);
|
||||
const directionalLight2 = directionalLight.clone();
|
||||
directionalLight2.position.set(0, 10, -5);
|
||||
const directionalLight3 = directionalLight.clone();
|
||||
directionalLight3.position.set(5, 10, 0);
|
||||
const directionalLight4 = directionalLight.clone();
|
||||
directionalLight4.position.set(-5, 10, 0);
|
||||
scene.add(directionalLight);
|
||||
scene.add(directionalLight2);
|
||||
scene.add(directionalLight3);
|
||||
scene.add(directionalLight4);
|
||||
|
||||
container.style.position = "relative";
|
||||
|
||||
const camera = new THREE.PerspectiveCamera(
|
||||
75,
|
||||
container.clientWidth / container.clientHeight,
|
||||
0.1,
|
||||
1000
|
||||
);
|
||||
|
||||
camera.position.set(0, 100, 10);
|
||||
camera.lookAt(0, 0, 0);
|
||||
camera.up.set(0, 1, 0);
|
||||
|
||||
const labelRenderer = new CSS2DRenderer();
|
||||
labelRenderer.domElement.style.position = "absolute";
|
||||
labelRenderer.domElement.style.top = "0px";
|
||||
labelRenderer.domElement.style.pointerEvents = "none";
|
||||
labelRenderer.setSize(container.clientWidth, container.clientHeight);
|
||||
container.appendChild(labelRenderer.domElement);
|
||||
|
||||
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
|
||||
renderer.setSize(container.clientWidth, container.clientHeight);
|
||||
renderer.setPixelRatio(window.devicePixelRatio || 1);
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
const controls = new OrbitControls(camera, renderer.domElement);
|
||||
controls.enableRotate = false;
|
||||
controls.enableZoom = false;
|
||||
controls.enablePan = false;
|
||||
controls.update();
|
||||
|
||||
const highlightMeshes = [];
|
||||
const pulseRings = [];
|
||||
const lineMaterials = [];
|
||||
|
||||
const tooltip = document.createElement("div");
|
||||
tooltip.style.cssText = "position:absolute;padding:6px 10px;background:rgba(24,118,242,0.92);color:#fff;font-size:13px;border-radius:6px;pointer-events:none;box-shadow:0 2px 6px rgba(0,0,0,0.25);display:none;";
|
||||
container.appendChild(tooltip);
|
||||
|
||||
const animate = () => {
|
||||
requestAnimationFrame(animate);
|
||||
const t = performance.now() * 0.001;
|
||||
pulseRings.forEach((mesh) => {
|
||||
const { minScale, maxScale, period, phase, baseOpacity } = mesh.userData;
|
||||
const progress = (t / period + phase) % 1;
|
||||
const eased = progress * progress * (3 - 2 * progress);
|
||||
const s = minScale + eased * (maxScale - minScale);
|
||||
mesh.scale.setScalar(s);
|
||||
const fadeIn = progress < 0.12 ? progress / 0.12 : 1.0;
|
||||
const fadeOut = progress > 0.7 ? Math.max(0.0, 1.0 - (progress - 0.7) / 0.3) : 1.0;
|
||||
const alpha = baseOpacity * Math.max(0.0, Math.min(1.0, fadeIn * fadeOut));
|
||||
if (mesh.material && mesh.material.uniforms && mesh.material.uniforms.opacity) {
|
||||
mesh.material.uniforms.opacity.value = alpha;
|
||||
}
|
||||
});
|
||||
controls.update();
|
||||
renderer.render(scene, camera);
|
||||
labelRenderer.render(scene, camera);
|
||||
};
|
||||
animate();
|
||||
|
||||
const raycaster = new THREE.Raycaster();
|
||||
const mouse = new THREE.Vector2();
|
||||
let hoverMesh = null;
|
||||
const hoverColor = new THREE.Color().setHSL(210 / 360, 0.7, 0.55);
|
||||
|
||||
const hideTooltip = () => { tooltip.style.display = "none"; };
|
||||
|
||||
const applyHoverState = (mesh) => {
|
||||
if (hoverMesh && hoverMesh !== mesh) {
|
||||
if (hoverMesh.material && hoverMesh.userData.baseColor) {
|
||||
hoverMesh.material.color.copy(hoverMesh.userData.baseColor);
|
||||
}
|
||||
}
|
||||
hoverMesh = mesh;
|
||||
if (hoverMesh && hoverMesh.material) {
|
||||
hoverMesh.material.color.copy(hoverColor);
|
||||
}
|
||||
};
|
||||
|
||||
const clearHoverState = () => {
|
||||
if (hoverMesh && hoverMesh.material && hoverMesh.userData.baseColor) {
|
||||
hoverMesh.material.color.copy(hoverMesh.userData.baseColor);
|
||||
}
|
||||
hoverMesh = null;
|
||||
};
|
||||
|
||||
const handlePointerMove = (event) => {
|
||||
const rect = container.getBoundingClientRect();
|
||||
mouse.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
|
||||
mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
|
||||
raycaster.setFromCamera(mouse, camera);
|
||||
const intersects = raycaster.intersectObjects(highlightMeshes, false);
|
||||
if (intersects.length > 0) {
|
||||
applyHoverState(intersects[0].object);
|
||||
} else {
|
||||
clearHoverState();
|
||||
hideTooltip();
|
||||
}
|
||||
};
|
||||
|
||||
container.addEventListener("mousemove", handlePointerMove);
|
||||
container.addEventListener("mouseleave", () => {
|
||||
clearHoverState();
|
||||
hideTooltip();
|
||||
});
|
||||
|
||||
window.addEventListener("resize", () => {
|
||||
camera.aspect = container.clientWidth / container.clientHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
renderer.setSize(container.clientWidth, container.clientHeight);
|
||||
labelRenderer.setSize(container.clientWidth, container.clientHeight);
|
||||
lineMaterials.forEach((m) => {
|
||||
if (m && m.resolution) {
|
||||
m.resolution.set(container.clientWidth, container.clientHeight);
|
||||
m.needsUpdate = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const offsetXY = d3.geoMercator();
|
||||
const highlightProvinces = ["山东省", "海南省", "天津市", "广东省", "浙江省", "江苏省", "北京市", "河北省", "辽宁省", "上海市"];
|
||||
const pulseProvinces = ["北京市", "上海市", "广东省"];
|
||||
|
||||
const createPulseRings = (data, depth) => {
|
||||
const group = new THREE.Object3D();
|
||||
data.features.forEach((feature) => {
|
||||
const { centroid, center, name } = feature.properties;
|
||||
if (!pulseProvinces.includes(name)) return;
|
||||
const point = centroid || center || [0, 0];
|
||||
const [x, y] = offsetXY(point);
|
||||
const geometry = new THREE.RingGeometry(0.0, 18.0, 160);
|
||||
|
||||
const makeMaterial = (colorCenterHex, colorEdgeHex, opacityVal, alphaInner = 0.45, alphaOuter = 1.0) => {
|
||||
return new THREE.ShaderMaterial({
|
||||
transparent: true,
|
||||
depthWrite: false,
|
||||
depthTest: false,
|
||||
side: THREE.DoubleSide,
|
||||
uniforms: {
|
||||
colorCenter: { value: new THREE.Color(colorCenterHex) },
|
||||
colorEdge: { value: new THREE.Color(colorEdgeHex) },
|
||||
opacity: { value: opacityVal },
|
||||
innerRatio: { value: geometry.parameters.innerRadius / geometry.parameters.outerRadius },
|
||||
alphaInner: { value: alphaInner },
|
||||
alphaOuter: { value: alphaOuter },
|
||||
},
|
||||
vertexShader: `
|
||||
varying vec2 vUv;
|
||||
void main() {
|
||||
vUv = uv;
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||||
}
|
||||
`,
|
||||
fragmentShader: `
|
||||
varying vec2 vUv;
|
||||
uniform vec3 colorCenter;
|
||||
uniform vec3 colorEdge;
|
||||
uniform float opacity;
|
||||
uniform float innerRatio;
|
||||
uniform float alphaInner;
|
||||
uniform float alphaOuter;
|
||||
void main() {
|
||||
vec2 p = vUv - vec2(0.5);
|
||||
float rawR = clamp(length(p) * 2.0, 0.0, 1.0);
|
||||
float r = clamp((rawR - innerRatio) / max(1.0 - innerRatio, 0.0001), 0.0, 1.0);
|
||||
float k = smoothstep(0.0, 1.0, r);
|
||||
vec3 color = mix(colorEdge, colorCenter, 1.0 - k);
|
||||
float alpha = opacity * mix(alphaInner, alphaOuter, k);
|
||||
if (alpha < 0.01) discard;
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
||||
`,
|
||||
});
|
||||
};
|
||||
|
||||
const baseRing = new THREE.Mesh(geometry.clone(), makeMaterial(0x31bbf7, 0x31bbf7, 0.1, 1.0, 1.0));
|
||||
baseRing.rotation.x = 0;
|
||||
baseRing.position.set(x, -y, depth + 0.02);
|
||||
baseRing.renderOrder = 10;
|
||||
group.add(baseRing);
|
||||
|
||||
const pulseRing = new THREE.Mesh(geometry.clone(), makeMaterial(0x9fdcff, 0x31bbf7, 0.45, 0.35, 1.0));
|
||||
pulseRing.rotation.x = 0;
|
||||
pulseRing.position.set(x, -y, depth + 0.02);
|
||||
pulseRing.renderOrder = 11;
|
||||
pulseRing.userData = {
|
||||
minScale: 1.0,
|
||||
maxScale: 1.3,
|
||||
period: 3.0,
|
||||
phase: Math.random(),
|
||||
baseOpacity: 0.25,
|
||||
};
|
||||
pulseRings.push(pulseRing);
|
||||
group.add(pulseRing);
|
||||
});
|
||||
return group;
|
||||
};
|
||||
|
||||
const createMap = (data, depth) => {
|
||||
const map = new THREE.Object3D();
|
||||
const center = data.features[0].properties.centroid;
|
||||
offsetXY.center(center).translate([0, 0]);
|
||||
data.features.forEach((feature) => {
|
||||
const unit = new THREE.Object3D();
|
||||
const { centroid, center, name } = feature.properties;
|
||||
const { coordinates, type } = feature.geometry;
|
||||
const point = centroid || center || [0, 0];
|
||||
|
||||
let color;
|
||||
if (highlightProvinces.includes(name)) {
|
||||
color = 0x2658F7;
|
||||
} else {
|
||||
color = new THREE.Color().setHSL(233 / 360, 0, 1).getHex();
|
||||
}
|
||||
|
||||
coordinates.forEach((coordinate) => {
|
||||
if (type === "MultiPolygon") coordinate.forEach((item) => fn(item));
|
||||
if (type === "Polygon") fn(coordinate);
|
||||
|
||||
function fn(coordinate) {
|
||||
unit.name = name;
|
||||
unit.centroid = point;
|
||||
const mesh = createMesh(coordinate, color, depth);
|
||||
mesh.userData = { name, centroid: point, baseColor: new THREE.Color(color) };
|
||||
if (highlightProvinces.includes(name)) {
|
||||
highlightMeshes.push(mesh);
|
||||
}
|
||||
const line = createLine(coordinate, depth);
|
||||
unit.add(mesh, ...line);
|
||||
}
|
||||
});
|
||||
map.add(unit);
|
||||
setCenter(map);
|
||||
});
|
||||
return map;
|
||||
};
|
||||
|
||||
const createMesh = (data, color, depth) => {
|
||||
const shape = new THREE.Shape();
|
||||
data.forEach((item, idx) => {
|
||||
const [x, y] = offsetXY(item);
|
||||
if (idx === 0) shape.moveTo(x, -y);
|
||||
else shape.lineTo(x, -y);
|
||||
});
|
||||
|
||||
const extrudeSettings = { depth: depth, bevelEnabled: false };
|
||||
const materialSettings = {
|
||||
color: color,
|
||||
emissive: 0x000000,
|
||||
roughness: 0.45,
|
||||
metalness: 0.8,
|
||||
transparent: true,
|
||||
side: THREE.DoubleSide,
|
||||
};
|
||||
const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
|
||||
const material = new THREE.MeshStandardMaterial(materialSettings);
|
||||
return new THREE.Mesh(geometry, material);
|
||||
};
|
||||
|
||||
const createLine = (data, depth) => {
|
||||
const positions = [];
|
||||
let firstX = null, firstY = null;
|
||||
data.forEach((item, idx) => {
|
||||
const [x, y] = offsetXY(item);
|
||||
positions.push(x, -y, 0);
|
||||
if (idx === 0) { firstX = x; firstY = y; }
|
||||
});
|
||||
if (firstX !== null && firstY !== null) {
|
||||
positions.push(firstX, -firstY, 0);
|
||||
}
|
||||
|
||||
const lineGeometry = new LineGeometry();
|
||||
lineGeometry.setPositions(positions);
|
||||
|
||||
const lineMaterialSettings = {
|
||||
color: 0xffffff,
|
||||
linewidth: 0.5,
|
||||
dashed: false,
|
||||
transparent: true,
|
||||
opacity: 0.9,
|
||||
};
|
||||
const uplineMaterial = new LineMaterial(lineMaterialSettings);
|
||||
const downlineMaterial = new LineMaterial(lineMaterialSettings);
|
||||
|
||||
uplineMaterial.resolution.set(container.clientWidth, container.clientHeight);
|
||||
downlineMaterial.resolution.set(container.clientWidth, container.clientHeight);
|
||||
|
||||
lineMaterials.push(uplineMaterial, downlineMaterial);
|
||||
|
||||
const upLine = new Line2(lineGeometry, uplineMaterial);
|
||||
const downLine = new Line2(lineGeometry.clone(), downlineMaterial);
|
||||
downLine.position.z = -0.0001;
|
||||
upLine.position.z = depth + 0.0001;
|
||||
return [upLine, downLine];
|
||||
};
|
||||
|
||||
const setCenter = (map) => {
|
||||
map.rotation.x = -Math.PI / 2;
|
||||
const box = new THREE.Box3().setFromObject(map);
|
||||
const center = box.getCenter(new THREE.Vector3());
|
||||
const offset = [0, 0];
|
||||
map.position.x = map.position.x - center.x - offset[0];
|
||||
map.position.z = map.position.z - center.z - offset[1];
|
||||
};
|
||||
|
||||
// 加载 GeoJSON 数据(使用预加载或重新加载)
|
||||
const url = "/assets/100000_full.json";
|
||||
try {
|
||||
const data = geoDataPromise ? await geoDataPromise : await (await fetch(url)).json();
|
||||
if (!data) throw new Error("No data available");
|
||||
const map = createMap(data, 0.05);
|
||||
map.add(createPulseRings(data, 0.05));
|
||||
scene.add(map);
|
||||
} catch (err) {
|
||||
console.error("Failed to load map data:", err);
|
||||
}
|
||||
}
|
||||
|
||||
// 使用 IntersectionObserver 实现懒加载
|
||||
function setupLazyMap() {
|
||||
const mapContainer = document.getElementById("map");
|
||||
if (!mapContainer) return;
|
||||
|
||||
// 预加载 GeoJSON 数据
|
||||
const preloadGeoData = async () => {
|
||||
const url = "/assets/100000_full.json";
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
return await res.json();
|
||||
} catch (err) {
|
||||
console.error("Failed to preload map data:", err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// 预加载 Three.js 模块
|
||||
const preloadThreeJS = async () => {
|
||||
try {
|
||||
await Promise.all([
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/controls/OrbitControls.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/renderers/CSS2DRenderer.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/Line2.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineMaterial.js'),
|
||||
import('https://cdn.jsdelivr.net/npm/three@latest/examples/jsm/lines/LineGeometry.js')
|
||||
]);
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error("Failed to preload Three.js:", err);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if ('IntersectionObserver' in window) {
|
||||
let geoDataPromise = null;
|
||||
let threeJSPromise = null;
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
if (entries[0].isIntersecting) {
|
||||
// 开始并行预加载
|
||||
geoDataPromise = preloadGeoData();
|
||||
threeJSPromise = preloadThreeJS();
|
||||
|
||||
// 立即初始化地图
|
||||
initMap3D(geoDataPromise, threeJSPromise);
|
||||
observer.disconnect();
|
||||
}
|
||||
}, {
|
||||
rootMargin: '1200px', // 提前 800px 开始加载(更早触发)
|
||||
threshold: 0.1 // 10% 可见时即触发
|
||||
});
|
||||
observer.observe(mapContainer);
|
||||
} else {
|
||||
// 降级:直接加载
|
||||
initMap3D();
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后设置懒加载
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', setupLazyMap);
|
||||
} else {
|
||||
setupLazyMap();
|
||||
}
|
||||
4
assets_backup/js/modernizr.custom.js
Normal file
4
assets_backup/js/modernizr.custom.js
Normal file
File diff suppressed because one or more lines are too long
156
assets_backup/js/new_file.js
Normal file
156
assets_backup/js/new_file.js
Normal file
@@ -0,0 +1,156 @@
|
||||
(function($) {
|
||||
$.fn.Slide = function(options) {
|
||||
var opts = $.extend({},
|
||||
$.fn.Slide.deflunt, options);
|
||||
var index = 1;
|
||||
var targetLi = $("." + opts.claNav + " li", $(this));
|
||||
var clickNext = $("." + opts.claNav + " .next", $(this));
|
||||
var clickPrev = $("." + opts.claNav + " .prev", $(this));
|
||||
var ContentBox = $("." + opts.claCon, $(this));
|
||||
var ContentBoxNum = ContentBox.children().size();
|
||||
var slideH = ContentBox.children().first().height();
|
||||
var slideW = ContentBox.children().first().width();
|
||||
var autoPlay;
|
||||
var slideWH;
|
||||
if (opts.effect == "scroolY" || opts.effect == "scroolTxt") {
|
||||
slideWH = slideH;
|
||||
} else if (opts.effect == "scroolX" || opts.effect == "scroolLoop") {
|
||||
ContentBox.css("width", ContentBoxNum * slideW);
|
||||
slideWH = slideW;
|
||||
} else if (opts.effect == "fade") {
|
||||
ContentBox.children().first().css("z-index", "1");
|
||||
}
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var doPlay = function() {
|
||||
$.fn.Slide.effect[opts.effect](ContentBox, targetLi, index, slideWH, opts);
|
||||
index++;
|
||||
if (index * opts.steps >= ContentBoxNum) {
|
||||
index = 0;
|
||||
}
|
||||
};
|
||||
clickNext.click(function(event) {
|
||||
$.fn.Slide.effectLoop.scroolLeft(ContentBox, targetLi, index, slideWH, opts,
|
||||
function() {
|
||||
for (var i = 0; i < opts.steps; i++) {
|
||||
ContentBox.find("li:first", $this).appendTo(ContentBox);
|
||||
}
|
||||
ContentBox.css({
|
||||
"left": "0"
|
||||
});
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
clickPrev.click(function(event) {
|
||||
for (var i = 0; i < opts.steps; i++) {
|
||||
ContentBox.find("li:last").prependTo(ContentBox);
|
||||
}
|
||||
ContentBox.css({
|
||||
"left": -index * opts.steps * slideW
|
||||
});
|
||||
$.fn.Slide.effectLoop.scroolRight(ContentBox, targetLi, index, slideWH, opts);
|
||||
event.preventDefault();
|
||||
});
|
||||
if (opts.autoPlay) {
|
||||
autoPlay = setInterval(doPlay, opts.timer);
|
||||
ContentBox.hover(function() {
|
||||
if (autoPlay) {
|
||||
clearInterval(autoPlay);
|
||||
}
|
||||
},
|
||||
function() {
|
||||
if (autoPlay) {
|
||||
clearInterval(autoPlay);
|
||||
}
|
||||
autoPlay = setInterval(doPlay, opts.timer);
|
||||
if ($("#Html5Video").attr('_isplaying')) {
|
||||
clearInterval(autoPlay);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
targetLi.click(function() {
|
||||
index = targetLi.index(this);
|
||||
window.setTimeout(function() {
|
||||
$.fn.Slide.effect[opts.effect](ContentBox, targetLi, index, slideWH, opts);
|
||||
},
|
||||
10);
|
||||
});
|
||||
});
|
||||
};
|
||||
$.fn.Slide.deflunt = {
|
||||
effect: "scroolY",
|
||||
autoPlay: true,
|
||||
speed: "normal",
|
||||
timer: 1000,
|
||||
defIndex: 0,
|
||||
claNav: "bannermenu",
|
||||
claCon: "caseul",
|
||||
steps: 1
|
||||
};
|
||||
$.fn.Slide.effectLoop = {
|
||||
scroolLeft: function(contentObj, navObj, i, slideW, opts, callback) {
|
||||
contentObj.animate({
|
||||
"left": -i * opts.steps * slideW
|
||||
},
|
||||
opts.speed, callback);
|
||||
if (navObj) {
|
||||
navObj.eq(i).addClass("on").siblings().removeClass("on");
|
||||
}
|
||||
},
|
||||
scroolRight: function(contentObj, navObj, i, slideW, opts, callback) {
|
||||
contentObj.stop().animate({
|
||||
"left": 0
|
||||
},
|
||||
opts.speed, callback);
|
||||
}
|
||||
}
|
||||
$.fn.Slide.effect = {
|
||||
fade: function(contentObj, navObj, i, slideW, opts) {
|
||||
contentObj.children().eq(i).stop().animate({
|
||||
opacity: 1
|
||||
},
|
||||
opts.speed).css({
|
||||
"z-index": "1"
|
||||
}).siblings().animate({
|
||||
opacity: 0
|
||||
},
|
||||
opts.speed).css({
|
||||
"z-index": "0"
|
||||
});
|
||||
navObj.eq(i).addClass("on").siblings().removeClass("on");
|
||||
},
|
||||
scroolTxt: function(contentObj, undefined, i, slideH, opts) {
|
||||
contentObj.animate({
|
||||
"margin-top": -opts.steps * slideH
|
||||
},
|
||||
opts.speed,
|
||||
function() {
|
||||
for (var j = 0; j < opts.steps; j++) {
|
||||
contentObj.find("li:first").appendTo(contentObj);
|
||||
}
|
||||
contentObj.css({
|
||||
"margin-top": "0"
|
||||
});
|
||||
});
|
||||
},
|
||||
scroolX: function(contentObj, navObj, i, slideW, opts, callback) {
|
||||
contentObj.stop().animate({
|
||||
"left": -i * opts.steps * slideW
|
||||
},
|
||||
opts.speed, callback);
|
||||
if (navObj) {
|
||||
navObj.eq(i).addClass("on").siblings().removeClass("on");
|
||||
}
|
||||
},
|
||||
scroolY: function(contentObj, navObj, i, slideH, opts) {
|
||||
contentObj.stop().animate({
|
||||
"top": -i * opts.steps * slideH
|
||||
},
|
||||
opts.speed);
|
||||
if (navObj) {
|
||||
navObj.eq(i).addClass("on").siblings().removeClass("on");
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
5
assets_backup/js/respond.min.js
vendored
Normal file
5
assets_backup/js/respond.min.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
||||
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
||||
* */
|
||||
|
||||
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
||||
646
assets_backup/js/script.js
Normal file
646
assets_backup/js/script.js
Normal file
@@ -0,0 +1,646 @@
|
||||
(function($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= ALL ESSENTIAL FUNCTIONS
|
||||
-------------------------------------------*/
|
||||
|
||||
// Toggle mobile navigation
|
||||
function toggleMobileNavigation() {
|
||||
var navbar = $(".navigation-holder");
|
||||
var openBtn = $(".navbar-header .open-btn");
|
||||
var closeBtn = $(".navigation-holder .close-navbar");
|
||||
var body = $(".page-wrapper");
|
||||
|
||||
openBtn.on("click", function() {
|
||||
if (!navbar.hasClass("slideInn")) {
|
||||
navbar.addClass("slideInn");
|
||||
body.addClass("body-overlay");
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
closeBtn.on("click", function() {
|
||||
if (navbar.hasClass("slideInn")) {
|
||||
navbar.removeClass("slideInn");
|
||||
}
|
||||
body.removeClass("body-overlay");
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
toggleMobileNavigation();
|
||||
|
||||
|
||||
// Function for toggle class for small menu
|
||||
function toggleClassForSmallNav() {
|
||||
var windowWidth = window.innerWidth;
|
||||
var mainNav = $("#navbar > ul");
|
||||
|
||||
if (windowWidth <= 991) {
|
||||
mainNav.addClass("small-nav");
|
||||
} else {
|
||||
mainNav.removeClass("small-nav");
|
||||
}
|
||||
}
|
||||
|
||||
toggleClassForSmallNav();
|
||||
|
||||
|
||||
// Function for small menu
|
||||
function smallNavFunctionality() {
|
||||
var windowWidth = window.innerWidth;
|
||||
var mainNav = $(".navigation-holder");
|
||||
var smallNav = $(".navigation-holder > .small-nav");
|
||||
var subMenu = smallNav.find(".sub-menu");
|
||||
var megamenu = smallNav.find(".mega-menu");
|
||||
var menuItemWidthSubMenu = smallNav.find(".menu-item-has-children > a");
|
||||
|
||||
if (windowWidth <= 991) {
|
||||
subMenu.hide();
|
||||
megamenu.hide();
|
||||
menuItemWidthSubMenu.on("click", function(e) {
|
||||
var $this = $(this);
|
||||
$this.siblings().slideToggle();
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
})
|
||||
} else if (windowWidth > 991) {
|
||||
mainNav.find(".sub-menu").show();
|
||||
mainNav.find(".mega-menu").show();
|
||||
}
|
||||
}
|
||||
|
||||
smallNavFunctionality();
|
||||
|
||||
|
||||
// Parallax background
|
||||
function bgParallax() {
|
||||
if ($(".parallax").length) {
|
||||
$(".parallax").each(function() {
|
||||
var height = $(this).position().top;
|
||||
var resize = height - $(window).scrollTop();
|
||||
var doParallax = -(resize/5);
|
||||
var positionValue = doParallax + "px";
|
||||
var img = $(this).data("bg-image");
|
||||
|
||||
$(this).css({
|
||||
backgroundImage: "url(" + img + ")",
|
||||
backgroundPosition: "50%" + positionValue,
|
||||
backgroundSize: "cover"
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HERO SLIDER
|
||||
var menu = [];
|
||||
jQuery('.swiper-slide').each( function(index){
|
||||
menu.push( jQuery(this).find('.slide-inner').attr("data-text") );
|
||||
});
|
||||
var interleaveOffset = 0.5;
|
||||
var swiperOptions = {
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
parallax: true,
|
||||
autoplay: {
|
||||
delay: 6500,
|
||||
disableOnInteraction: false,
|
||||
},
|
||||
watchSlidesProgress: true,
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
},
|
||||
|
||||
on: {
|
||||
progress: function() {
|
||||
var swiper = this;
|
||||
for (var i = 0; i < swiper.slides.length; i++) {
|
||||
var slideProgress = swiper.slides[i].progress;
|
||||
var innerOffset = swiper.width * interleaveOffset;
|
||||
var innerTranslate = slideProgress * innerOffset;
|
||||
swiper.slides[i].querySelector(".slide-inner").style.transform =
|
||||
"translate3d(" + innerTranslate + "px, 0, 0)";
|
||||
}
|
||||
},
|
||||
|
||||
touchStart: function() {
|
||||
var swiper = this;
|
||||
for (var i = 0; i < swiper.slides.length; i++) {
|
||||
swiper.slides[i].style.transition = "";
|
||||
}
|
||||
},
|
||||
|
||||
setTransition: function(speed) {
|
||||
var swiper = this;
|
||||
for (var i = 0; i < swiper.slides.length; i++) {
|
||||
swiper.slides[i].style.transition = speed + "ms";
|
||||
swiper.slides[i].querySelector(".slide-inner").style.transition =
|
||||
speed + "ms";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var swiper = new Swiper(".swiper-container", swiperOptions);
|
||||
|
||||
// DATA BACKGROUND IMAGE
|
||||
var sliderBgSetting = $(".slide-bg-image");
|
||||
sliderBgSetting.each(function(indx){
|
||||
if ($(this).attr("data-background")){
|
||||
$(this).css("background-image", "url(" + $(this).data("background") + ")");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= HIDE PRELOADER
|
||||
-------------------------------------------*/
|
||||
function preloader() {
|
||||
if($('.preloader').length) {
|
||||
$('.preloader').delay(100).fadeOut(500, function() {
|
||||
|
||||
//active wow
|
||||
wow.init();
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= WOW ANIMATION SETTING
|
||||
-------------------------------------------*/
|
||||
var wow = new WOW({
|
||||
boxClass: 'wow', // default
|
||||
animateClass: 'animated', // default
|
||||
offset: 0, // default
|
||||
mobile: true, // default
|
||||
live: true // default
|
||||
});
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= ACTIVE POPUP IMAGE
|
||||
-------------------------------------------*/
|
||||
if ($(".fancybox").length) {
|
||||
$(".fancybox").fancybox({
|
||||
openEffect : "elastic",
|
||||
closeEffect : "elastic",
|
||||
wrapCSS : "project-fancybox-title-style"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= POPUP VIDEO
|
||||
-------------------------------------------*/
|
||||
if ($(".video-btn").length) {
|
||||
$(".video-btn").on("click", function(){
|
||||
$.fancybox({
|
||||
href: this.href,
|
||||
type: $(this).data("type"),
|
||||
'title' : this.title,
|
||||
helpers : {
|
||||
title : { type : 'inside' },
|
||||
media : {}
|
||||
},
|
||||
|
||||
beforeShow : function(){
|
||||
$(".fancybox-wrap").addClass("gallery-fancybox");
|
||||
}
|
||||
});
|
||||
return false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= ACTIVE GALLERY POPUP IMAGE
|
||||
-------------------------------------------*/
|
||||
if ($(".popup-gallery").length) {
|
||||
$('.popup-gallery').magnificPopup({
|
||||
delegate: 'a',
|
||||
type: 'image',
|
||||
|
||||
gallery: {
|
||||
enabled: true
|
||||
},
|
||||
|
||||
zoom: {
|
||||
enabled: true,
|
||||
|
||||
duration: 300,
|
||||
easing: 'ease-in-out',
|
||||
opener: function(openerElement) {
|
||||
return openerElement.is('img') ? openerElement : openerElement.find('img');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= FUNCTION FORM SORTING GALLERY
|
||||
-------------------------------------------*/
|
||||
function sortingGallery() {
|
||||
if ($(".sortable-gallery .gallery-filters").length) {
|
||||
var $container = $('.gallery-container');
|
||||
$container.isotope({
|
||||
filter:'*',
|
||||
animationOptions: {
|
||||
duration: 750,
|
||||
easing: 'linear',
|
||||
queue: false,
|
||||
}
|
||||
});
|
||||
|
||||
$(".gallery-filters li a").on("click", function() {
|
||||
$('.gallery-filters li .current').removeClass('current');
|
||||
$(this).addClass('current');
|
||||
var selector = $(this).attr('data-filter');
|
||||
$container.isotope({
|
||||
filter:selector,
|
||||
animationOptions: {
|
||||
duration: 750,
|
||||
easing: 'linear',
|
||||
queue: false,
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
sortingGallery();
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= MASONRY GALLERY SETTING
|
||||
-------------------------------------------*/
|
||||
function masonryGridSetting() {
|
||||
if ($('.masonry-gallery').length) {
|
||||
var $grid = $('.masonry-gallery').masonry({
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-item',
|
||||
percentPosition: true
|
||||
});
|
||||
|
||||
$grid.imagesLoaded().progress( function() {
|
||||
$grid.masonry('layout');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// masonryGridSetting();
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= STICKY HEADER
|
||||
-------------------------------------------*/
|
||||
// Function for clone an element for sticky menu
|
||||
function cloneNavForSticyMenu($ele, $newElmClass) {
|
||||
$ele.addClass('original').clone().insertAfter($ele).addClass($newElmClass).removeClass('original');
|
||||
}
|
||||
|
||||
// clone home style 1 navigation for sticky menu
|
||||
if ($('.site-header .navigation').length) {
|
||||
cloneNavForSticyMenu($('.site-header .navigation'), "sticky-header");
|
||||
}
|
||||
|
||||
var lastScrollTop = '';
|
||||
|
||||
function stickyMenu($targetMenu, $toggleClass) {
|
||||
var st = $(window).scrollTop();
|
||||
var mainMenuTop = $('.site-header .navigation');
|
||||
|
||||
if ($(window).scrollTop() > 1000) {
|
||||
if (st > lastScrollTop) {
|
||||
// hide sticky menu on scroll down
|
||||
$targetMenu.removeClass($toggleClass);
|
||||
|
||||
} else {
|
||||
// active sticky menu on scroll up
|
||||
$targetMenu.addClass($toggleClass);
|
||||
}
|
||||
|
||||
} else {
|
||||
$targetMenu.removeClass($toggleClass);
|
||||
}
|
||||
|
||||
lastScrollTop = st;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= HEADER SEARCH AREA
|
||||
-------------------------------------------*/
|
||||
if ($(".header-search-area").length) {
|
||||
var serachFormBox = $(".header-search-area .header-search-form");
|
||||
var openSeachBtn = $(".header-search-area .open-btn");
|
||||
|
||||
$(document.body).append(serachFormBox);
|
||||
serachFormBox.hide();
|
||||
|
||||
openSeachBtn.on("click", function(e) {
|
||||
serachFormBox.fadeIn();
|
||||
return false;
|
||||
});
|
||||
|
||||
serachFormBox.on("click", function() {
|
||||
serachFormBox.fadeOut();
|
||||
return false;
|
||||
}).find(".form").on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= PROGRESS BAR
|
||||
-------------------------------------------*/
|
||||
function progressBar() {
|
||||
if ($(".progress-bar").length) {
|
||||
var $progress_bar = $('.progress-bar');
|
||||
$progress_bar.appear();
|
||||
$(document.body).on('appear', '.progress-bar', function() {
|
||||
var current_item = $(this);
|
||||
if (!current_item.hasClass('appeared')) {
|
||||
var percent = current_item.data('percent');
|
||||
current_item.css('width', percent + '%').addClass('appeared').parent().append('<span>' + percent + '%' + '</span>');
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
}
|
||||
progressBar();
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= FUNFACT
|
||||
-------------------------------------------*/
|
||||
if ($(".odometer").length) {
|
||||
$('.odometer').appear();
|
||||
$(document.body).on('appear', '.odometer', function(e) {
|
||||
var odo = $(".odometer");
|
||||
odo.each(function() {
|
||||
var countNumber = $(this).attr("data-count");
|
||||
$(this).html(countNumber);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= PORTFOLIO SLIDER
|
||||
-------------------------------------------*/
|
||||
if ($(".portfolio-slider").length) {
|
||||
$(".portfolio-slider").owlCarousel({
|
||||
autoplay: false,
|
||||
smartSpeed: 300,
|
||||
margin: 0,
|
||||
loop:true,
|
||||
autoplayHoverPause:true,
|
||||
dots: false,
|
||||
responsive: {
|
||||
0 : {
|
||||
items: 1
|
||||
},
|
||||
|
||||
500 : {
|
||||
items: 2
|
||||
},
|
||||
|
||||
768 : {
|
||||
items: 3
|
||||
},
|
||||
|
||||
1200 : {
|
||||
items: 4
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= PARTNERS SLIDER
|
||||
-------------------------------------------*/
|
||||
if ($(".partners-slider").length) {
|
||||
$(".partners-slider").owlCarousel({
|
||||
autoplay:true,
|
||||
smartSpeed: 300,
|
||||
margin: 30,
|
||||
loop:true,
|
||||
autoplayHoverPause:true,
|
||||
dots: false,
|
||||
responsive: {
|
||||
0 : {
|
||||
items: 2
|
||||
},
|
||||
|
||||
550 : {
|
||||
items: 3
|
||||
},
|
||||
|
||||
992 : {
|
||||
items: 4
|
||||
},
|
||||
|
||||
1200 : {
|
||||
items: 5
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= SERVICES SLIDER
|
||||
-------------------------------------------*/
|
||||
if ($(".services-slider").length) {
|
||||
$(".services-slider").owlCarousel({
|
||||
loop:true,
|
||||
margin: 30,
|
||||
smartSpeed: 500,
|
||||
responsive:{
|
||||
0 : {
|
||||
items: 1,
|
||||
},
|
||||
|
||||
550 : {
|
||||
items: 2,
|
||||
center: false,
|
||||
margin: 10
|
||||
},
|
||||
|
||||
992 : {
|
||||
items: 3,
|
||||
center: false,
|
||||
margin: 10
|
||||
},
|
||||
|
||||
1400:{
|
||||
items:3
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= TESTIMONIAL SLIDER
|
||||
-------------------------------------------*/
|
||||
if ($(".testimonial-slider").length) {
|
||||
$(".testimonial-slider").owlCarousel({
|
||||
items: 1,
|
||||
loop:true,
|
||||
smartSpeed: 500,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= PORTFOLIO SLIDER S2
|
||||
-------------------------------------------*/
|
||||
if ($(".portfolio-slider-s2").length) {
|
||||
$(".portfolio-slider-s2").owlCarousel({
|
||||
autoplay: false,
|
||||
smartSpeed: 300,
|
||||
margin: 0,
|
||||
loop:true,
|
||||
autoplayHoverPause:true,
|
||||
dots: false,
|
||||
responsive: {
|
||||
0 : {
|
||||
items: 1
|
||||
},
|
||||
|
||||
500 : {
|
||||
items: 2
|
||||
},
|
||||
|
||||
768 : {
|
||||
items: 3
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= POST SLIDER
|
||||
-------------------------------------------*/
|
||||
if($(".post-slider".length)) {
|
||||
$(".post-slider").owlCarousel({
|
||||
mouseDrag: false,
|
||||
smartSpeed: 500,
|
||||
margin: 30,
|
||||
loop:true,
|
||||
nav: true,
|
||||
navText: ['<i class="fi flaticon-back"></i>','<i class="fi flaticon-next"></i>'],
|
||||
dots: false,
|
||||
items: 1
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------
|
||||
= RSVP FORM SUBMISSION
|
||||
-------------------------------------------*/
|
||||
if ($("#contact-form-main").length) {
|
||||
$("#contact-form-main").validate({
|
||||
rules: {
|
||||
name: {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
|
||||
email: "required",
|
||||
|
||||
phone: "required",
|
||||
|
||||
},
|
||||
|
||||
messages: {
|
||||
name: "Please enter your name",
|
||||
email: "Please enter your email address",
|
||||
phone: "Please enter your phone number",
|
||||
},
|
||||
|
||||
submitHandler: function (form) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "mail-contact.php",
|
||||
data: $(form).serialize(),
|
||||
success: function () {
|
||||
$( "#loader").hide();
|
||||
$( "#success").slideDown( "slow" );
|
||||
setTimeout(function() {
|
||||
$( "#success").slideUp( "slow" );
|
||||
}, 3000);
|
||||
form.reset();
|
||||
},
|
||||
error: function() {
|
||||
$( "#loader").hide();
|
||||
$( "#error").slideDown( "slow" );
|
||||
setTimeout(function() {
|
||||
$( "#error").slideUp( "slow" );
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
return false; // required to block normal submit since you used ajax
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*==========================================================================
|
||||
WHEN DOCUMENT LOADING
|
||||
==========================================================================*/
|
||||
$(window).on('load', function() {
|
||||
|
||||
preloader();
|
||||
|
||||
|
||||
toggleMobileNavigation();
|
||||
|
||||
smallNavFunctionality();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*==========================================================================
|
||||
WHEN WINDOW SCROLL
|
||||
|
||||
|
||||
/*==========================================================================
|
||||
WHEN WINDOW RESIZE
|
||||
==========================================================================*/
|
||||
$(window).on("resize", function() {
|
||||
toggleClassForSmallNav();
|
||||
|
||||
clearTimeout($.data(this, 'resizeTimer'));
|
||||
|
||||
$.data(this, 'resizeTimer', setTimeout(function() {
|
||||
smallNavFunctionality();
|
||||
}, 200));
|
||||
});
|
||||
|
||||
|
||||
})(window.jQuery);
|
||||
252
assets_backup/js/timeline.js
Normal file
252
assets_backup/js/timeline.js
Normal file
@@ -0,0 +1,252 @@
|
||||
/**
|
||||
* 智慧时间轴组件 - 横向展开式
|
||||
* Smart Timeline Component - Horizontal Expansion
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// 等待DOM加载完成
|
||||
document.addEventListener('DOMContentLoaded', initTimeline);
|
||||
|
||||
function initTimeline() {
|
||||
const container = document.querySelector('.timeline-container');
|
||||
if (!container) return;
|
||||
|
||||
const items = container.querySelectorAll('.timeline-item');
|
||||
if (!items.length) return;
|
||||
|
||||
// 入场动画 - 使用 Intersection Observer
|
||||
const observerOptions = {
|
||||
threshold: 0.1,
|
||||
rootMargin: '0px 0px -50px 0px'
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
animateItems();
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, observerOptions);
|
||||
|
||||
observer.observe(container);
|
||||
|
||||
// 节点逐个入场动画
|
||||
function animateItems() {
|
||||
items.forEach((item, index) => {
|
||||
setTimeout(() => {
|
||||
item.style.opacity = '1';
|
||||
item.style.transform = 'translateY(0)';
|
||||
}, index * 80);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化节点样式(用于动画)
|
||||
items.forEach(item => {
|
||||
item.style.opacity = '0';
|
||||
item.style.transform = 'translateY(20px)';
|
||||
item.style.transition = 'opacity 0.5s ease, transform 0.5s ease, flex 0.5s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.5s ease';
|
||||
});
|
||||
|
||||
// 触摸设备支持
|
||||
let touchStartX = null;
|
||||
let scrollLeft = null;
|
||||
|
||||
container.addEventListener('touchstart', (e) => {
|
||||
touchStartX = e.touches[0].pageX;
|
||||
scrollLeft = container.scrollLeft;
|
||||
}, { passive: true });
|
||||
|
||||
container.addEventListener('touchmove', (e) => {
|
||||
if (!touchStartX) return;
|
||||
const x = e.touches[0].pageX;
|
||||
const walk = (touchStartX - x) * 1.5;
|
||||
container.scrollLeft = scrollLeft + walk;
|
||||
}, { passive: true });
|
||||
|
||||
container.addEventListener('touchend', () => {
|
||||
touchStartX = null;
|
||||
});
|
||||
|
||||
// 鼠标滚轮横向滚动(移动端视图时)
|
||||
container.addEventListener('wheel', (e) => {
|
||||
if (container.scrollWidth > container.clientWidth) {
|
||||
if (Math.abs(e.deltaX) < Math.abs(e.deltaY)) {
|
||||
e.preventDefault();
|
||||
container.scrollLeft += e.deltaY;
|
||||
}
|
||||
}
|
||||
}, { passive: false });
|
||||
|
||||
// 拖拽滚动(移动端视图时)
|
||||
let isDragging = false;
|
||||
let startX;
|
||||
let dragScrollLeft;
|
||||
|
||||
container.addEventListener('mousedown', (e) => {
|
||||
if (container.scrollWidth <= container.clientWidth) return;
|
||||
if (e.target.closest('.timeline-item')) return;
|
||||
isDragging = true;
|
||||
container.style.cursor = 'grabbing';
|
||||
startX = e.pageX - container.offsetLeft;
|
||||
dragScrollLeft = container.scrollLeft;
|
||||
});
|
||||
|
||||
container.addEventListener('mouseleave', () => {
|
||||
isDragging = false;
|
||||
container.style.cursor = '';
|
||||
});
|
||||
|
||||
container.addEventListener('mouseup', () => {
|
||||
isDragging = false;
|
||||
container.style.cursor = '';
|
||||
});
|
||||
|
||||
container.addEventListener('mousemove', (e) => {
|
||||
if (!isDragging) return;
|
||||
e.preventDefault();
|
||||
const x = e.pageX - container.offsetLeft;
|
||||
const walk = (x - startX) * 2;
|
||||
container.scrollLeft = dragScrollLeft - walk;
|
||||
});
|
||||
|
||||
// 节点点击事件(可扩展)
|
||||
items.forEach((item) => {
|
||||
item.addEventListener('click', () => {
|
||||
// 添加点击反馈动画
|
||||
const dot = item.querySelector('.dot');
|
||||
if (dot) {
|
||||
dot.style.transform = 'translate(-50%, -50%) scale(2)';
|
||||
setTimeout(() => {
|
||||
dot.style.transform = '';
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 键盘导航支持
|
||||
let currentIndex = 0;
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (!isElementInViewport(container)) return;
|
||||
|
||||
if (e.key === 'ArrowLeft') {
|
||||
currentIndex = Math.max(0, currentIndex - 1);
|
||||
scrollToItem(currentIndex);
|
||||
} else if (e.key === 'ArrowRight') {
|
||||
currentIndex = Math.min(items.length - 1, currentIndex + 1);
|
||||
scrollToItem(currentIndex);
|
||||
}
|
||||
});
|
||||
|
||||
function scrollToItem(index) {
|
||||
if (container.scrollWidth <= container.clientWidth) return;
|
||||
|
||||
const item = items[index];
|
||||
if (!item) return;
|
||||
|
||||
const containerRect = container.getBoundingClientRect();
|
||||
const itemRect = item.getBoundingClientRect();
|
||||
|
||||
const targetScrollLeft = container.scrollLeft + (itemRect.left - containerRect.left) - (containerRect.width / 2) + (itemRect.width / 2);
|
||||
|
||||
container.scrollTo({
|
||||
left: targetScrollLeft,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// 自动轮播功能 - 从左到右循环展开
|
||||
// ============================================
|
||||
let autoPlayIndex = 0;
|
||||
let autoPlayTimer = null;
|
||||
let isUserInteracting = false;
|
||||
const autoPlayInterval = 3000; // 每个节点展开持续时间(毫秒)
|
||||
const pauseAfterInteraction = 5000; // 用户交互后暂停时间(毫秒)
|
||||
|
||||
// 添加自动展开的CSS类
|
||||
function expandItem(index) {
|
||||
// 移除所有节点的展开状态
|
||||
items.forEach(item => {
|
||||
item.classList.remove('auto-expanded');
|
||||
});
|
||||
// 给当前节点添加展开状态
|
||||
if (items[index]) {
|
||||
items[index].classList.add('auto-expanded');
|
||||
}
|
||||
}
|
||||
|
||||
// 自动轮播
|
||||
function autoPlay() {
|
||||
if (isUserInteracting) return;
|
||||
|
||||
expandItem(autoPlayIndex);
|
||||
autoPlayIndex = (autoPlayIndex + 1) % items.length;
|
||||
}
|
||||
|
||||
// 启动自动轮播
|
||||
function startAutoPlay() {
|
||||
if (autoPlayTimer) return;
|
||||
autoPlayTimer = setInterval(autoPlay, autoPlayInterval);
|
||||
// 立即展开第一个
|
||||
autoPlay();
|
||||
}
|
||||
|
||||
// 停止自动轮播
|
||||
function stopAutoPlay() {
|
||||
if (autoPlayTimer) {
|
||||
clearInterval(autoPlayTimer);
|
||||
autoPlayTimer = null;
|
||||
}
|
||||
// 移除所有展开状态
|
||||
items.forEach(item => {
|
||||
item.classList.remove('auto-expanded');
|
||||
});
|
||||
}
|
||||
|
||||
// 用户交互时暂停自动轮播
|
||||
function pauseAutoPlay() {
|
||||
isUserInteracting = true;
|
||||
stopAutoPlay();
|
||||
|
||||
// 一段时间后恢复自动轮播
|
||||
setTimeout(() => {
|
||||
isUserInteracting = false;
|
||||
if (isElementInViewport(container)) {
|
||||
startAutoPlay();
|
||||
}
|
||||
}, pauseAfterInteraction);
|
||||
}
|
||||
|
||||
// 监听用户交互
|
||||
container.addEventListener('mouseenter', pauseAutoPlay);
|
||||
container.addEventListener('touchstart', pauseAutoPlay, { passive: true });
|
||||
|
||||
// 使用 Intersection Observer 控制自动轮播
|
||||
const autoPlayObserver = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting && !isUserInteracting) {
|
||||
startAutoPlay();
|
||||
} else {
|
||||
stopAutoPlay();
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.3 });
|
||||
|
||||
autoPlayObserver.observe(container);
|
||||
|
||||
console.log("Timeline Loaded with Enhanced Labels and Positioning");
|
||||
}
|
||||
|
||||
// 工具函数:检查元素是否在视口中
|
||||
function isElementInViewport(el) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
return (
|
||||
rect.top < window.innerHeight &&
|
||||
rect.bottom > 0
|
||||
);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user