This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
!function(a){function b(b,c,d){b.on("mousedown.ba-events touchstart.ba-events",function(e){b.addClass("ba-draggable"),c.addClass("ba-resizable");var f=e.pageX?e.pageX:e.originalEvent.touches[0].pageX,g=b.outerWidth(),h=b.offset().left+g-f,i=d.offset().left,j=d.outerWidth();minLeft=i+10,maxLeft=i+j-g-10,b.parents().on("mousemove.ba-events touchmove.ba-events",function(b){var c=b.pageX?b.pageX:b.originalEvent.touches[0].pageX;leftValue=c+h-g,leftValue<minLeft?leftValue=minLeft:leftValue>maxLeft&&(leftValue=maxLeft),widthValue=100*(leftValue+g/2-i)/j+"%",a(".ba-draggable").css("left",widthValue),a(".ba-resizable").css("width",widthValue)}).on("mouseup.ba-events touchend.ba-events touchcancel.ba-events",function(){b.removeClass("ba-draggable"),c.removeClass("ba-resizable"),a(this).off(".ba-events")}),e.preventDefault()})}a.fn.beforeAfter=function(){var c=this,d=c.width()+"px";c.find(".resize img").css("width",d),b(c.find(".handle"),c.find(".resize"),c),a(window).resize(function(){var a=c.width()+"px";c.find(".resize img").css("width",a)})}}(jQuery);

View File

@@ -0,0 +1,216 @@
/**
* BxSlider v4.1.2 - Fully loaded, responsive content slider
* http://bxslider.com
*
* Written by: Steven Wanderski, 2014
* http://stevenwanderski.com
* (while drinking Belgian ales and listening to jazz)
*
* CEO and founder of bxCreative, LTD
* http://bxcreative.com
*/
/** RESET AND LAYOUT
===================================*/
.bx-wrapper {
position: relative;
margin: 0 auto;
padding: 0;
*zoom: 1;
}
.bx-wrapper img {
max-width: 100%;
display: block;
}
/** THEME
===================================*/
.bx-wrapper .bx-viewport {
background: #fff;
/*fix other elements on the page moving (on Chrome)*/
-webkit-transform: translatez(0);
-moz-transform: translatez(0);
-ms-transform: translatez(0);
-o-transform: translatez(0);
transform: translatez(0);
}
.goods_Related .bx-wrapper .bx-viewport{background-color:transparent;;}
.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
position: absolute;
bottom: -0.15rem;
width: 100%;
}
/* LOADER */
.bx-wrapper .bx-loading {
min-height: 50px;
background: url(../images/bx_loader.gif) center center no-repeat #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
}
/* PAGER */
.bx-wrapper .bx-pager {
text-align: center;
font-size: .85em;
font-family: Arial;
font-weight: bold;
color: #666;
padding-top: 20px;
}
.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
display: inline-block;
*zoom: 1;
*display: inline;
}
.bx-wrapper .bx-pager.bx-default-pager a {
background: #d9d9d9;
text-indent: -9999px;
display: block;
width: 10px;
height: 10px;
margin: 0 5px;
outline: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active {
background: #009fdf;
}
/* DIRECTION CONTROLS (NEXT / PREV) */
.goods_Related .bx-wrapper .bx-prev {
left: -0.96rem;
background: url(../../images/bx-left.png);
background-size:0.38rem 0.7rem;
-moz-background-size:0.38rem 0.7rem; /* 老版本的 Firefox */
background-repeat:no-repeat;
}
.goods_Related .bx-wrapper .bx-next {
right: -0.96rem;
background: url(../../images/bx-right.png);
background-size:0.38rem 0.7rem;
-moz-background-size:0.38rem 0.7rem; /* 老版本的 Firefox */
background-repeat:no-repeat;
}
/*.bx-wrapper .bx-prev:hover {
background-position: 0 0;
}
.bx-wrapper .bx-next:hover {
background-position: -43px 0;
}*/
.bx-wrapper .bx-controls-direction a {
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
width: 32px;
height: 32px;
text-indent: -9999px;
z-index: 9999;
}
.goods_Related .bx-wrapper .bx-controls-direction a {
position: absolute;
top:50%;
outline: 0;
width: 0.38rem;
height: 0.7rem;
margin-top:-1.25rem;
text-indent: -9999px;
z-index: 999;
}
/*.bx-wrapper .bx-controls-direction a.disabled {
display: none;
}*/
/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto {
text-align: center;
}
.bx-wrapper .bx-controls-auto .bx-start {
display: block;
text-indent: -9999px;
width: 10px;
height: 11px;
outline: 0;
background: url(../images/controls.png) -86px -11px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active {
background-position: -86px 0;
}
.bx-wrapper .bx-controls-auto .bx-stop {
display: block;
text-indent: -9999px;
width: 9px;
height: 11px;
outline: 0;
background: url(../images/controls.png) -86px -44px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active {
background-position: -86px -33px;
}
/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
text-align: left;
width: 80%;
}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
right: 0;
width: 35px;
}
/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption {
position: absolute;
bottom: 0;
left: 0;
background: #666\9;
background: rgba(80, 80, 80, 0.75);
width: 100%;
}
.bx-wrapper .bx-caption span {
color: #fff;
font-family: Arial;
display: block;
font-size: .85em;
padding: 10px;
}

View File

@@ -0,0 +1,196 @@
/**
* BxSlider v4.0 - Fully loaded, responsive content slider
* http://bxslider.com
*
* Written by: Steven Wanderski, 2012
* http://stevenwanderski.com
* (while drinking Belgian ales and listening to jazz)
*
* CEO and founder of bxCreative, LTD
* http://bxcreative.com
*/
/** RESET AND LAYOUT
===================================*/
.bx-wrapper {
position: relative;
margin: 0 auto;
padding: 0;
*zoom: 1;
}
.bx-wrapper img {
max-width: 100%;
display: block;
}
/** THEME
===================================*/
.bx-wrapper .bx-pager,
.bx-wrapper .bx-controls-auto {
position: absolute;
bottom: -1.5rem;
width: 100%;
}
/* LOADER */
.bx-wrapper .bx-loading {
min-height: 50px;
background: url(images/bx_loader.gif) center center no-repeat #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2000;
}
/* PAGER */
.banner .bx-wrapper .bx-pager {
text-align: center;
font-size: 0.85em;
font-family: Arial;
font-weight: bold;
color: transparent;
padding-bottom: 10%;
}
.partner .bx-wrapper .bx-pager {
text-align: center;
font-size: 0.85em;
font-family: Arial;
font-weight: bold;
color: transparent;
}
.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item {
display: inline-block;
*zoom: 1;
*display: inline;
}
.banner .bx-wrapper .bx-pager.bx-default-pager a {
background: #c6ced6;
text-indent: -9999px;
display: block;
width: 10px;
height: 10px;
margin: 0 5px;
outline: 0;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
color: transparent;
}
.banner .bx-wrapper .bx-pager.bx-default-pager a a:hover,
.banner .bx-wrapper .bx-pager.bx-default-pager a.active {
background: #004bfa;
width: 20px;
height: 10px;
}
/* DIRECTION CONTROLS (NEXT / PREV) */
.bx-wrapper .bx-prev {
left: 10px;
background: url(images/controls.png) no-repeat 0 -32px;
}
.bx-wrapper .bx-next {
right: 10px;
background: url(images/controls.png) no-repeat -43px -32px;
}
.bx-wrapper .bx-prev:hover {
background-position: 0 0;
}
.bx-wrapper .bx-next:hover {
background-position: -43px 0;
}
.bx-wrapper .bx-controls-direction a {
position: absolute;
top: 50%;
margin-top: -16px;
outline: 0;
width: 32px;
height: 32px;
text-indent: -9999px;
z-index: 9999;
}
.bx-wrapper .bx-controls-direction a.disabled {
display: none;
}
/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto {
text-align: center;
}
.bx-wrapper .bx-controls-auto .bx-start {
display: block;
text-indent: -9999px;
width: 10px;
height: 11px;
outline: 0;
background: url(images/controls.png) -86px -11px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active {
background-position: -86px 0;
}
.bx-wrapper .bx-controls-auto .bx-stop {
display: block;
text-indent: -9999px;
width: 9px;
height: 11px;
outline: 0;
background: url(images/controls.png) -86px -44px no-repeat;
margin: 0 3px;
}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active {
background-position: -86px -33px;
}
/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager {
text-align: left;
width: 80%;
}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto {
right: 0;
width: 35px;
}
/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption {
position: absolute;
bottom: 0;
left: 0;
background: #666\9;
background: rgba(80, 80, 80, 0.75);
width: 100%;
}
.bx-wrapper .bx-caption span {
color: #fff;
font-family: Arial;
display: block;
font-size: 0.85em;
padding: 10px;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
var _pattern = "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos"
var _regex = new RegExp(_pattern, "ig");
var _UA = navigator.userAgent;
var domainUrl = window.location.href;
var pathUrl = window.location.pathname;
if(_regex.test(_UA) && pathUrl.search("/us/") != -1){
}
else{
location.href=domainUrl.replace('/usmobile/', '/us/');
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,294 @@
jQuery(document).ready(function ($) {
var timelines = $('.cd-horizontal-timeline'),
eventsMinDistance = 60
timelines.length > 0 && initTimeline(timelines)
function initTimeline(timelines) {
timelines.each(function () {
var timeline = $(this),
timelineComponents = {}
//cache timeline components
timelineComponents['timelineWrapper'] = timeline.find('.events-wrapper')
timelineComponents['eventsWrapper'] = timelineComponents['timelineWrapper'].children('.events')
timelineComponents['fillingLine'] = timelineComponents['eventsWrapper'].children('.filling-line')
timelineComponents['timelineEvents'] = timelineComponents['eventsWrapper'].find('a')
timelineComponents['timelineDates'] = parseDate(timelineComponents['timelineEvents'])
timelineComponents['eventsMinLapse'] = minLapse(timelineComponents['timelineDates'])
timelineComponents['timelineNavigation'] = timeline.find('.cd-timeline-navigation')
timelineComponents['eventsContent'] = timeline.children('.events-content')
//assign a left postion to the single events along the timeline
setDatePosition(timelineComponents, eventsMinDistance)
//assign a width to the timeline
var timelineTotWidth = setTimelineWidth(timelineComponents, eventsMinDistance)
//the timeline has been initialize - show it
timeline.addClass('loaded')
//detect click on the next arrow
timelineComponents['timelineNavigation'].on('click', '.next', function (event) {
event.preventDefault()
updateSlide(timelineComponents, timelineTotWidth, 'next')
})
//detect click on the prev arrow
timelineComponents['timelineNavigation'].on('click', '.prev', function (event) {
event.preventDefault()
updateSlide(timelineComponents, timelineTotWidth, 'prev')
})
//detect click on the a single event - show new event content
timelineComponents['eventsWrapper'].on('click', 'a', function (event) {
event.preventDefault()
timelineComponents['timelineEvents'].removeClass('selected')
$(this).addClass('selected')
updateOlderEvents($(this))
updateFilling($(this), timelineComponents['fillingLine'], timelineTotWidth)
updateVisibleContent($(this), timelineComponents['eventsContent'])
})
//on swipe, show next/prev event content
timelineComponents['eventsContent'].on('swipeleft', function () {
var mq = checkMQ()
mq == 'mobile' && showNewContent(timelineComponents, timelineTotWidth, 'next')
})
timelineComponents['eventsContent'].on('swiperight', function () {
var mq = checkMQ()
mq == 'mobile' && showNewContent(timelineComponents, timelineTotWidth, 'prev')
})
//keyboard navigation
$(document).keyup(function (event) {
if (event.which == '37' && elementInViewport(timeline.get(0))) {
showNewContent(timelineComponents, timelineTotWidth, 'prev')
} else if (event.which == '39' && elementInViewport(timeline.get(0))) {
showNewContent(timelineComponents, timelineTotWidth, 'next')
}
})
})
}
function updateSlide(timelineComponents, timelineTotWidth, string) {
//retrieve translateX value of timelineComponents['eventsWrapper']
var translateValue = getTranslateValue(timelineComponents['eventsWrapper']),
wrapperWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', ''))
//translate the timeline to the left('next')/right('prev')
string == 'next'
? translateTimeline(timelineComponents, translateValue - wrapperWidth + eventsMinDistance, wrapperWidth - timelineTotWidth)
: translateTimeline(timelineComponents, translateValue + wrapperWidth - eventsMinDistance)
}
function showNewContent(timelineComponents, timelineTotWidth, string) {
//go from one event to the next/previous one
var visibleContent = timelineComponents['eventsContent'].find('.selected'),
newContent = string == 'next' ? visibleContent.next() : visibleContent.prev()
if (newContent.length > 0) {
//if there's a next/prev event - show it
var selectedDate = timelineComponents['eventsWrapper'].find('.selected'),
newEvent =
string == 'next' ? selectedDate.parent('li').next('li').children('a') : selectedDate.parent('li').prev('li').children('a')
updateFilling(newEvent, timelineComponents['fillingLine'], timelineTotWidth)
updateVisibleContent(newEvent, timelineComponents['eventsContent'])
newEvent.addClass('selected')
selectedDate.removeClass('selected')
updateOlderEvents(newEvent)
updateTimelinePosition(string, newEvent, timelineComponents)
}
}
function updateTimelinePosition(string, event, timelineComponents) {
//translate timeline to the left/right according to the position of the selected event
var eventStyle = window.getComputedStyle(event.get(0), null),
eventLeft = Number(eventStyle.getPropertyValue('left').replace('px', '')),
timelineWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')),
timelineTotWidth = Number(timelineComponents['eventsWrapper'].css('width').replace('px', ''))
var timelineTranslate = getTranslateValue(timelineComponents['eventsWrapper'])
if ((string == 'next' && eventLeft > timelineWidth - timelineTranslate) || (string == 'prev' && eventLeft < -timelineTranslate)) {
translateTimeline(timelineComponents, -eventLeft + timelineWidth / 2, timelineWidth - timelineTotWidth)
}
}
function translateTimeline(timelineComponents, value, totWidth) {
var eventsWrapper = timelineComponents['eventsWrapper'].get(0)
value = value > 0 ? 0 : value //only negative translate value
value = !(typeof totWidth === 'undefined') && value < totWidth ? totWidth : value //do not translate more than timeline width
setTransformValue(eventsWrapper, 'translateX', value + 'px')
//update navigation arrows visibility
value == 0
? timelineComponents['timelineNavigation'].find('.prev').addClass('inactive')
: timelineComponents['timelineNavigation'].find('.prev').removeClass('inactive')
value == totWidth
? timelineComponents['timelineNavigation'].find('.next').addClass('inactive')
: timelineComponents['timelineNavigation'].find('.next').removeClass('inactive')
}
function updateFilling(selectedEvent, filling, totWidth) {
//change .filling-line length according to the selected event
var eventStyle = window.getComputedStyle(selectedEvent.get(0), null),
eventLeft = eventStyle.getPropertyValue('left'),
eventWidth = eventStyle.getPropertyValue('width')
eventLeft = Number(eventLeft.replace('px', '')) + Number(eventWidth.replace('px', '')) / 2
var scaleValue = eventLeft / totWidth
setTransformValue(filling.get(0), 'scaleX', scaleValue)
}
function setDatePosition(timelineComponents, min) {
for (i = 0; i < timelineComponents['timelineDates'].length; i++) {
var distance = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][i]),
distanceNorm = Math.round(distance / timelineComponents['eventsMinLapse']) + 2
timelineComponents['timelineEvents'].eq(i).css('left', distanceNorm * min + 'px')
}
}
function setTimelineWidth(timelineComponents, width) {
var timeSpan = daydiff(
timelineComponents['timelineDates'][0],
timelineComponents['timelineDates'][timelineComponents['timelineDates'].length - 1]
),
timeSpanNorm = timeSpan / timelineComponents['eventsMinLapse'],
timeSpanNorm = Math.round(timeSpanNorm) + 4,
totalWidth = timeSpanNorm * width
timelineComponents['eventsWrapper'].css('width', totalWidth + 'px')
updateFilling(timelineComponents['eventsWrapper'].find('a.selected'), timelineComponents['fillingLine'], totalWidth)
updateTimelinePosition('next', timelineComponents['eventsWrapper'].find('a.selected'), timelineComponents)
return totalWidth
}
function updateVisibleContent(event, eventsContent) {
var eventDate = event.data('date'),
visibleContent = eventsContent.find('.selected'),
selectedContent = eventsContent.find('[data-date="' + eventDate + '"]'),
selectedContentHeight = selectedContent.height()
if (selectedContent.index() > visibleContent.index()) {
var classEnetering = 'selected enter-right',
classLeaving = 'leave-left'
} else {
var classEnetering = 'selected enter-left',
classLeaving = 'leave-right'
}
selectedContent.attr('class', classEnetering)
visibleContent.attr('class', classLeaving).one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function () {
visibleContent.removeClass('leave-right leave-left')
selectedContent.removeClass('enter-left enter-right')
})
eventsContent.css('height', selectedContentHeight + 'px')
}
function updateOlderEvents(event) {
event
.parent('li')
.prevAll('li')
.children('a')
.addClass('older-event')
.end()
.end()
.nextAll('li')
.children('a')
.removeClass('older-event')
}
function getTranslateValue(timeline) {
var timelineStyle = window.getComputedStyle(timeline.get(0), null),
timelineTranslate =
timelineStyle.getPropertyValue('-webkit-transform') ||
timelineStyle.getPropertyValue('-moz-transform') ||
timelineStyle.getPropertyValue('-ms-transform') ||
timelineStyle.getPropertyValue('-o-transform') ||
timelineStyle.getPropertyValue('transform')
if (timelineTranslate.indexOf('(') >= 0) {
var timelineTranslate = timelineTranslate.split('(')[1]
timelineTranslate = timelineTranslate.split(')')[0]
timelineTranslate = timelineTranslate.split(',')
var translateValue = timelineTranslate[4]
} else {
var translateValue = 0
}
return Number(translateValue)
}
function setTransformValue(element, property, value) {
element.style['-webkit-transform'] = property + '(' + value + ')'
element.style['-moz-transform'] = property + '(' + value + ')'
element.style['-ms-transform'] = property + '(' + value + ')'
element.style['-o-transform'] = property + '(' + value + ')'
element.style['transform'] = property + '(' + value + ')'
}
//based on http://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-javascript
function parseDate(events) {
var dateArrays = []
events.each(function () {
var singleDate = $(this),
dateComp = singleDate.data('date').split('T')
if (dateComp.length > 1) {
//both DD/MM/YEAR and time are provided
var dayComp = dateComp[0].split('/'),
timeComp = dateComp[1].split(':')
} else if (dateComp[0].indexOf(':') >= 0) {
//only time is provide
var dayComp = ['2000', '0', '0'],
timeComp = dateComp[0].split(':')
} else {
//only DD/MM/YEAR
var dayComp = dateComp[0].split('/'),
timeComp = ['0', '0']
}
var newDate = new Date(dayComp[2], dayComp[1] - 1, dayComp[0], timeComp[0], timeComp[1])
dateArrays.push(newDate)
})
return dateArrays
}
function daydiff(first, second) {
return Math.round(second - first)
}
function minLapse(dates) {
//determine the minimum distance among events
var dateDistances = []
for (i = 1; i < dates.length; i++) {
var distance = daydiff(dates[i - 1], dates[i])
dateDistances.push(distance)
}
return Math.min.apply(null, dateDistances)
}
/*
How to tell if a DOM element is visible in the current viewport?
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function elementInViewport(el) {
var top = el.offsetTop
var left = el.offsetLeft
var width = el.offsetWidth
var height = el.offsetHeight
while (el.offsetParent) {
el = el.offsetParent
top += el.offsetTop
left += el.offsetLeft
}
return (
top < window.pageYOffset + window.innerHeight &&
left < window.pageXOffset + window.innerWidth &&
top + height > window.pageYOffset &&
left + width > window.pageXOffset
)
}
function checkMQ() {
//check if mobile or desktop device
return window
.getComputedStyle(document.querySelector('.cd-horizontal-timeline'), '::before')
.getPropertyValue('content')
.replace(/'/g, '')
.replace(/"/g, '')
}
})

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,117 @@
;(function(win, lib) {
var doc = win.document;
var docEl = doc.documentElement;
var metaEl = doc.querySelector('meta[name="viewport"]');
var flexibleEl = doc.querySelector('meta[name="flexible"]');
var dpr = 0;
var scale = 0;
var tid;
var flexible = lib.flexible || (lib.flexible = {});
if (metaEl) {
console.warn('将根据已有的meta标签来设置缩放比例');
var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/);
if (match) {
scale = parseFloat(match[1]);
dpr = parseInt(1 / scale);
}
} else if (flexibleEl) {
var content = flexibleEl.getAttribute('content');
if (content) {
var initialDpr = content.match(/initial\-dpr=([\d\.]+)/);
var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/);
if (initialDpr) {
dpr = parseFloat(initialDpr[1]);
scale = parseFloat((1 / dpr).toFixed(2));
}
if (maximumDpr) {
dpr = parseFloat(maximumDpr[1]);
scale = parseFloat((1 / dpr).toFixed(2));
}
}
}
if (!dpr && !scale) {
var isAndroid = win.navigator.appVersion.match(/android/gi);
var isIPhone = win.navigator.appVersion.match(/iphone/gi);
var devicePixelRatio = win.devicePixelRatio;
if (isIPhone) {
// iOS下对于2和3的屏用2倍的方案其余的用1倍方案
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
dpr = 3;
} else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){
dpr = 2;
} else {
dpr = 1;
}
} else {
// 其他设备下仍旧使用1倍的方案
dpr = 1;
}
scale = 1 / dpr;
}
docEl.setAttribute('data-dpr', dpr);
if (!metaEl) {
metaEl = doc.createElement('meta');
metaEl.setAttribute('name', 'viewport');
metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no');
if (docEl.firstElementChild) {
docEl.firstElementChild.appendChild(metaEl);
} else {
var wrap = doc.createElement('div');
wrap.appendChild(metaEl);
doc.write(wrap.innerHTML);
}
}
function refreshRem(){
var width = docEl.getBoundingClientRect().width;
if (width / dpr > 540) {
width = 540 * dpr;
}
var rem = width / 10;
docEl.style.fontSize = rem + 'px';
flexible.rem = win.rem = rem;
}
win.addEventListener('resize', function() {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}, false);
win.addEventListener('pageshow', function(e) {
if (e.persisted) {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}
}, false);
if (doc.readyState === 'complete') {
doc.body.style.fontSize = 12 * dpr + 'px';
} else {
doc.addEventListener('DOMContentLoaded', function(e) {
doc.body.style.fontSize = 12 * dpr + 'px';
}, false);
}
refreshRem();
flexible.dpr = win.dpr = dpr;
flexible.refreshRem = refreshRem;
flexible.rem2px = function(d) {
var val = parseFloat(d) * this.rem;
if (typeof d === 'string' && d.match(/rem$/)) {
val += 'px';
}
return val;
}
flexible.px2rem = function(d) {
var val = parseFloat(d) / this.rem;
if (typeof d === 'string' && d.match(/px$/)) {
val += 'rem';
}
return val;
}
})(window, window['lib'] || (window['lib'] = {}));

View File

@@ -0,0 +1,117 @@
;(function(win, lib) {
var doc = win.document;
var docEl = doc.documentElement;
var metaEl = doc.querySelector('meta[name="viewport"]');
var flexibleEl = doc.querySelector('meta[name="flexible"]');
var dpr = 0;
var scale = 0;
var tid;
var flexible = lib.flexible || (lib.flexible = {});
if (metaEl) {
console.warn('将根据已有的meta标签来设置缩放比例');
var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/);
if (match) {
scale = parseFloat(match[1]);
dpr = parseInt(1 / scale);
}
} else if (flexibleEl) {
var content = flexibleEl.getAttribute('content');
if (content) {
var initialDpr = content.match(/initial\-dpr=([\d\.]+)/);
var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/);
if (initialDpr) {
dpr = parseFloat(initialDpr[1]);
scale = parseFloat((1 / dpr).toFixed(2));
}
if (maximumDpr) {
dpr = parseFloat(maximumDpr[1]);
scale = parseFloat((1 / dpr).toFixed(2));
}
}
}
if (!dpr && !scale) {
var isAndroid = win.navigator.appVersion.match(/android/gi);
var isIPhone = win.navigator.appVersion.match(/iphone/gi);
var devicePixelRatio = win.devicePixelRatio;
if (isIPhone) {
// iOS下对于2和3的屏用2倍的方案其余的用1倍方案
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
dpr = 3;
} else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){
dpr = 2;
} else {
dpr = 1;
}
} else {
// 其他设备下仍旧使用1倍的方案
dpr = 1;
}
scale = 1 / dpr;
}
docEl.setAttribute('data-dpr', dpr);
if (!metaEl) {
metaEl = doc.createElement('meta');
metaEl.setAttribute('name', 'viewport');
metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no');
if (docEl.firstElementChild) {
docEl.firstElementChild.appendChild(metaEl);
} else {
var wrap = doc.createElement('div');
wrap.appendChild(metaEl);
doc.write(wrap.innerHTML);
}
}
function refreshRem(){
var width = docEl.getBoundingClientRect().width;
if (width / dpr > 768) {
width = 768 * dpr;
}
var rem = width / 10;
docEl.style.fontSize = rem + 'px';
flexible.rem = win.rem = rem;
}
win.addEventListener('resize', function() {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}, false);
win.addEventListener('pageshow', function(e) {
if (e.persisted) {
clearTimeout(tid);
tid = setTimeout(refreshRem, 300);
}
}, false);
if (doc.readyState === 'complete') {
doc.body.style.fontSize = 12 * dpr + 'px';
} else {
doc.addEventListener('DOMContentLoaded', function(e) {
doc.body.style.fontSize = 12 * dpr + 'px';
}, false);
}
refreshRem();
flexible.dpr = win.dpr = dpr;
flexible.refreshRem = refreshRem;
flexible.rem2px = function(d) {
var val = parseFloat(d) * this.rem;
if (typeof d === 'string' && d.match(/rem$/)) {
val += 'px';
}
return val;
}
flexible.px2rem = function(d) {
var val = parseFloat(d) / this.rem;
if (typeof d === 'string' && d.match(/px$/)) {
val += 'rem';
}
return val;
}
})(window, window['lib'] || (window['lib'] = {}));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,91 @@
/*
* 移动端模拟导航可点击自动滑动 0.1.4
* Date: 2017-01-11
* by: xiewei
* 导航可左右滑动可点击边缘的一个自动滚动下一个到可视范围【依赖于iscroll.js】
*/
(function ($) {
$.fn.navbarscroll = function (options) {
//各种属性、参数
var _defaults = {
className:'cur', //当前选中点击元素的class类名
clickScrollTime:300, //点击后滑动时间
duibiScreenWidth:0.4, //单位以rem为准默认为0.4rem
scrollerWidth:0, //单位以px为准默认为3,[仅用于特殊情况:外层宽度因为小数点造成的不精准情况]
defaultSelect:0, //初始选中第n个默认第0个
fingerClick:0, //目标第0或1个选项触发,必须每一项长度一致,方可用此项
endClickScroll:function(thisObj){}//回调函数
}
var _opt = $.extend(_defaults, options);
this.each(function () {
//插件实现代码
var _wrapper = $(this);
var _win = $(window);
var _win_width = _win.width(),_wrapper_width = _wrapper.width(),_wrapper_off_left = _wrapper.offset().left;
var _wrapper_off_right=_win_width-_wrapper_off_left-_wrapper_width;
var _obj_scroller = _wrapper.children('.scroller');
var _obj_ul = _obj_scroller.children('ul');
var _obj_li = _obj_ul.children('li');
var _scroller_w = 0;
_obj_li.css({"margin-left":"0","margin-right":"0"});
for (var i = 0; i < _obj_li.length; i++) {
_scroller_w += _obj_li[i].offsetWidth+_obj_li.length*2;
}
_obj_scroller.width(_scroller_w+_opt.scrollerWidth);
//alert( _scroller_w);
var myScroll = new IScroll('#'+_wrapper.attr('id'), {
eventPassthrough: true,
scrollX: true,
scrollY: false,
preventDefault: false
});
_init(_obj_li.eq(_opt.defaultSelect));
_obj_li.click(function(){
_init($(this));
});
//解决PC端谷歌浏览器模拟的手机屏幕出现莫名的卡顿现象滑动时禁止默认事件2017-01-11
_wrapper[0].addEventListener('touchmove',function (e){e.preventDefault();},false);
function _init(thiObj){
var $this_obj=thiObj;
var duibi=_opt.duibiScreenWidth*_win_width/10,this_index=$this_obj.index(),this_off_left=$this_obj.offset().left,this_pos_left=$this_obj.position().left,this_width=$this_obj.width(),this_prev_width=$this_obj.prev('li').width(),this_next_width=$this_obj.next('li').width();
var this_off_right=_win_width-this_off_left-this_width;
if(_scroller_w+2>_wrapper_width){
if(_opt.fingerClick==1){
if(this_index==1){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_index==0){
myScroll.scrollTo(-this_pos_left,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-2){
myScroll.scrollBy(this_off_right-_wrapper_off_right-this_width,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-1){
myScroll.scrollBy(this_off_right-_wrapper_off_right,0, _opt.clickScrollTime);
}else{
if(this_off_left-_wrapper_off_left-(this_width*_opt.fingerClick)<duibi){
myScroll.scrollTo(-this_pos_left+this_prev_width+(this_width*_opt.fingerClick),0, _opt.clickScrollTime);
}else if(this_off_right-_wrapper_off_right-(this_width*_opt.fingerClick)<duibi){
myScroll.scrollBy(this_off_right-this_next_width-_wrapper_off_right-(this_width*_opt.fingerClick),0, _opt.clickScrollTime);
}
}
}else{
if(this_index==1){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_index==_obj_li.length-1){
if(this_off_right-_wrapper_off_right>1||this_off_right-_wrapper_off_right<-1){
myScroll.scrollBy(this_off_right-_wrapper_off_right,0, _opt.clickScrollTime);
}
}else{
if(this_off_left-_wrapper_off_left<duibi){
myScroll.scrollTo(-this_pos_left+this_prev_width,0, _opt.clickScrollTime);
}else if(this_off_right-_wrapper_off_right<duibi){
myScroll.scrollBy(this_off_right-this_next_width-_wrapper_off_right,0, _opt.clickScrollTime);
}
}
}
}
$this_obj.addClass(_opt.className).siblings('li').removeClass(_opt.className);
_opt.endClickScroll.call(this,$this_obj);
}
});
};
})(jQuery);

14
public/frontend/m_weben/js/swiper.min.js vendored Executable file

File diff suppressed because one or more lines are too long

2
public/frontend/m_weben/js/wow.min.js vendored Executable file

File diff suppressed because one or more lines are too long