ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,253 @@
|
||||
define([
|
||||
'jquery',
|
||||
'jquery-ui-modules/widget',
|
||||
'jquery-ui-modules/core',
|
||||
'jquery-ui-modules/effect',
|
||||
'owl.carousel',
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
var animation_text_space = 0;
|
||||
|
||||
$.widget('mage.OxBannerSlider', {
|
||||
options: {
|
||||
// OxBannerSlider
|
||||
autoScroll: 0,
|
||||
slideWidth: 0,
|
||||
slideHeight: 0,
|
||||
customNav: true,
|
||||
// Owl.carousel
|
||||
dots: false,
|
||||
rewind: false,
|
||||
items: 1,
|
||||
slideBy: 1,
|
||||
lazyLoad: true,
|
||||
responsive: {
|
||||
0: {
|
||||
items: 1,
|
||||
},
|
||||
},
|
||||
nav: false,
|
||||
observerLoad: !(window.hasOwnProperty('OX_OWL_OBS_DISABLE') ? OX_OWL_OBS_DISABLE : false)
|
||||
},
|
||||
_create: function () {
|
||||
this.options.responsiveBaseElement = this.element.parent();
|
||||
this.options.autoplayTimeout = parseInt(this.options.autoScroll) * 1000;
|
||||
this.options.autoplay = 0 < this.options.autoplayTimeout;
|
||||
this.options.autoplayHoverPause = this.options.autoplay;
|
||||
if (this.options.observerLoad) {
|
||||
this._loadObserver();
|
||||
} else {
|
||||
this._loadOwl();
|
||||
}
|
||||
},
|
||||
_loadObserver: function () {
|
||||
let _self = this;
|
||||
if (window.IntersectionObserver) {
|
||||
let observer = new IntersectionObserver(function (entries, observer) {
|
||||
Array.prototype.forEach.call(entries, function (entry) {
|
||||
if (entry.isIntersecting) {
|
||||
_self._loadOwl.call(_self);
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, {
|
||||
root: null,
|
||||
rootMargin: "0px",
|
||||
threshold: [0]
|
||||
});
|
||||
this.element.each(function (i, el) {
|
||||
observer.observe(el);
|
||||
});
|
||||
} else {
|
||||
let debouncer = function (func) {
|
||||
var timeoutID;
|
||||
return function () {
|
||||
var scope = this,
|
||||
args = arguments;
|
||||
clearTimeout(timeoutID);
|
||||
timeoutID = setTimeout(function () {
|
||||
func.apply(scope, Array.prototype.slice.call(args));
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
$(window).one('scroll resize', debouncer(function () {
|
||||
let height = window.visualViewport ? window.visualViewport.height : window.innerHeight;
|
||||
this.element.each(function (i, el) {
|
||||
let bounding = el.getBoundingClientRect();
|
||||
if (bounding.top != bounding.bottom && 0 < bounding.bottom && height > bounding.top) {
|
||||
_self._loadOwl.call(_self);
|
||||
}
|
||||
})
|
||||
}));
|
||||
}
|
||||
},
|
||||
_loadOwl: function () {
|
||||
var options = this._createOptions();
|
||||
this.element.owlCarousel(options);
|
||||
this.arrows();
|
||||
},
|
||||
_createOptions: function () {
|
||||
var _self = this;
|
||||
var options = {
|
||||
onInitialize: function () {
|
||||
var $carousel = this.$element,
|
||||
$items = $carousel.find('.ox-banner__slide'),
|
||||
$text_container = $carousel.find('.ox-banner__text-container'),
|
||||
$text = $text_container.find('.text'),
|
||||
$link = $text_container.find('.link');
|
||||
this.$element.data('textSize', parseInt($text.css('font-size'), 10));
|
||||
this.$element.data('textLineHeight', parseInt($text.css('line-height'), 10));
|
||||
this.$element.data('linkSize', parseInt($link.css('font-size'), 12));
|
||||
|
||||
$text_container.show();
|
||||
$text.wrap('<div class="animation-wrapper animation-text" />');
|
||||
$link.wrap('<div class="animation-wrapper animation-link" />');
|
||||
$carousel.find('.ox-banner__text-container br').hide();
|
||||
|
||||
$carousel.find('.ox-banner__text-container.center').each(function () {
|
||||
$(this).attr('data-margin', $(this).css('margin'));
|
||||
});
|
||||
|
||||
_self._initBannerText($carousel);
|
||||
|
||||
//banner hover
|
||||
$items.on('mouseenter',
|
||||
function () {
|
||||
$('.ox-banner__text-container .animation-wrapper', this).each(function (i) {
|
||||
$(this)
|
||||
.delay(64 * (i))
|
||||
.queue(function (next) {
|
||||
$(this).addClass('animate-me');
|
||||
next();
|
||||
});
|
||||
});
|
||||
}).on('mouseleave',
|
||||
function () {
|
||||
$('.ox-banner__text-container .animation-wrapper', this).each(function (i) {
|
||||
$(this)
|
||||
.delay(64 * i)
|
||||
.queue(function (next) {
|
||||
$(this).removeClass('animate-me');
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
onInitialized: function () {
|
||||
this.$element.closest('.ox-banners-slider__container').eq(0).css('height', '');
|
||||
|
||||
_self._resizeSlides(this.$element, this);
|
||||
_self.__initBannerText(this.$element);
|
||||
_self._afterMove(this.$element);
|
||||
|
||||
},
|
||||
onRefresh: function () {
|
||||
this.$element.find('.ox-banner__text-container .animation-wrapper').css('width', '0px');
|
||||
},
|
||||
onRefreshed: function () {
|
||||
_self._resizeSlides(this.$element, this);
|
||||
_self.__initBannerText(this.$element);
|
||||
_self._afterMove(this.$element);
|
||||
},
|
||||
onChanged: function () {
|
||||
var carouselId = this.$element.attr('id');
|
||||
var $wraper = this.$element.closest('.ox-banners-slider__container').eq(0);
|
||||
var current = this.current();
|
||||
var $nav = $wraper.find('#' + carouselId + '_nav').toggle(this.settings.items < this.items().length);
|
||||
var disable_nav_min = current === this.minimum();
|
||||
var disable_nav_max = current === this.maximum();
|
||||
if (this.settings.loop) {
|
||||
disable_nav_min = disable_nav_max = false;
|
||||
}
|
||||
$nav.find('.ox-owl-next').toggleClass('disabled', disable_nav_max);
|
||||
$nav.find('.ox-owl-prev').toggleClass('disabled', disable_nav_min);
|
||||
_self._afterMove(this);
|
||||
}
|
||||
};
|
||||
|
||||
return $.extend({}, options, this.options);
|
||||
|
||||
},
|
||||
__initBannerText: function ($this) {
|
||||
var _self = this;
|
||||
setTimeout(function () {
|
||||
_self._initBannerText($this);
|
||||
}, 200);
|
||||
},
|
||||
_initBannerText: function ($this) {
|
||||
var carouselHeight = $this.find('.ox-banner__slide .ox-banner__link-wrapper').height();
|
||||
|
||||
$('.animation-wrapper', $this).removeAttr('style').attr({'data-width': '', 'data-height': ''});
|
||||
$('.ox-banner__text-container .text, .ox-banner__text-container .link', $this).each(function () {
|
||||
var w = $(this).outerWidth(!0) + animation_text_space,
|
||||
h = $(this).outerHeight();
|
||||
|
||||
$(this).parent()
|
||||
.attr('data-width', w)
|
||||
.attr('data-height', h)
|
||||
.width(0)
|
||||
.height(h);
|
||||
});
|
||||
$('.ox-banner__text-container.center', $this).each(function () {
|
||||
$(this)
|
||||
.css('margin', $(this).attr('data-margin'))
|
||||
.css('margin-top', parseInt((carouselHeight - $(this).height()) / 2) + 'px');
|
||||
});
|
||||
},
|
||||
_afterMove: function ($this) {
|
||||
var animationDelay = this.options.animationDelay;
|
||||
var animationTimeout = this.options.animationTimeout;
|
||||
setTimeout(function () {
|
||||
$.each($this._items, function (index, item) {
|
||||
var text_animation = $('.ox-banner__text-container .animation-wrapper', item);
|
||||
if (item.hasClass('active')) {
|
||||
text_animation.each(function (i) {
|
||||
$(this).delay(animationTimeout * i).animate({width: $(this).attr('data-width')}, animationDelay, 'easeOutExpo');
|
||||
});
|
||||
} else {
|
||||
text_animation.css('width', 0);
|
||||
}
|
||||
|
||||
});
|
||||
}, 400);
|
||||
},
|
||||
|
||||
_resizeSlides: function ($this, owl) {
|
||||
var carousel = owl.$element;
|
||||
var newWidth = $(owl._items[0]).width(),
|
||||
newHeight = Math.round(newWidth * this.options.slideHeight / this.options.slideWidth),
|
||||
ratio = $(owl._items[0]).width() / this.options.slideWidth,
|
||||
newTextSize = Math.ceil($(carousel).data('textSize') * ratio),
|
||||
newTextLineHeight = Math.ceil($(carousel).data('textLineHeight') * ratio) + 1,
|
||||
newLinkSize = Math.ceil($(carousel).data('linkSize') * ratio);
|
||||
|
||||
$('.ox-banner__slide .ox-banner__link-wrapper', carousel).width(newWidth).height(newHeight);
|
||||
$('.ox-banner__slide .ox-banner-slider__image', carousel).css({
|
||||
'transform': 'scale(' + ratio + ')',
|
||||
'-ms-transform': 'scale(' + ratio + ')',
|
||||
'-webkit-transform': 'scale(' + ratio + ')'
|
||||
});
|
||||
|
||||
$('.ox-banner__slide .ox-banner__text-container .text', carousel).css('font-size', newTextSize + 'px');
|
||||
$('.ox-banner__slide .ox-banner__text-container .text', carousel).css('line-height', newTextLineHeight + 'px');
|
||||
$('.ox-banner__slide .ox-banner__text-container .link', carousel).css('font-size', newLinkSize + 'px');
|
||||
|
||||
$(carousel).animate({height: newHeight + 'px'}, 1000, 'easeOutExpo');
|
||||
},
|
||||
arrows: function () {
|
||||
if (this.options.customNav) {
|
||||
var $wraper = this.element.closest('.ox-banners-slider__container').eq(0);
|
||||
$wraper.on('click', '.ox-owl-next', $.proxy(function () {
|
||||
this.element.trigger('next.owl.carousel');
|
||||
}, this));
|
||||
$wraper.on('click', '.ox-owl-prev', $.proxy(function () {
|
||||
this.element.trigger('prev.owl.carousel');
|
||||
}, this));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return $.mage.OxBannerSlider;
|
||||
});
|
||||
@@ -0,0 +1,355 @@
|
||||
@athlete-banner-slider__main-color: #ffe51e;
|
||||
@font-weight__black: 800;
|
||||
|
||||
& when (@media-common = true) {
|
||||
|
||||
.animation-link {
|
||||
.lib-css(transition, ~"transform 256ms cubic-bezier(0.330, 0.975, 0.245, 0.910)", @_prefix: 1);
|
||||
}
|
||||
/* @TODO banners slider sidebar */
|
||||
.sidebar .banners-slider-container { margin: 0 auto 15px; }
|
||||
.sidebar .banners-slider-container .text-container .text { font-size: 28px; }
|
||||
.col3-layout .sidebar .banners-slider-container .text-container .text { font-size: 22px; }
|
||||
/*.col3-layout .sidebar .banners-slider-container .text-container .link { font-size: 10px; }*/
|
||||
/*.col2-left-layout .col-main .banners-slider-container,
|
||||
.col2-right-layout .col-main .banners-slider-container {width:640px;}
|
||||
.col3-layout .col-main .banners-slider-container {width:320px;} */
|
||||
|
||||
//
|
||||
// Banner Slider
|
||||
// _____________________________________________
|
||||
|
||||
.ox-banners-slider__container{
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
-webkit-transform: translateZ(0);
|
||||
.owl-carousel .owl-item .owl-lazy.ox-banner-slider__image,
|
||||
.ox-banner-slider__image{
|
||||
.lib-css(transition, ~"all 400ms ease-in-out", @_prefix: 1);
|
||||
-webkit-transform:scale(1) !important;
|
||||
-moz-transform:scale(1) !important;
|
||||
-o-transform:scale(1) !important;
|
||||
transform:scale(1) !important;
|
||||
}
|
||||
|
||||
.ox-banner__banners{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
/*overflow: hidden; */
|
||||
list-style: none;
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translateZ(0);
|
||||
.ox-banner__slide{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
float: left;
|
||||
.ox-banner__link-wrapper{
|
||||
display: block;
|
||||
padding:0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translateZ(0);
|
||||
.ox-banner-slider__image{
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
position: absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
-webkit-backface-visibility: hidden;
|
||||
-webkit-transform: translateZ(0) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bottom-left,
|
||||
.top-left {
|
||||
left: 0;
|
||||
.animation-link.animate-me{
|
||||
transform:translateX(10px);
|
||||
}
|
||||
}
|
||||
.top-left {
|
||||
top: 0;
|
||||
}
|
||||
.bottom-left {
|
||||
bottom: 0;
|
||||
}
|
||||
.bottom-right,
|
||||
.top-right {
|
||||
right: 0;
|
||||
text-align: right;
|
||||
.animation-wrapper {
|
||||
margin-left: auto;
|
||||
}
|
||||
.animation-link.animate-me{
|
||||
transform:translateX(-10px);
|
||||
}
|
||||
}
|
||||
.top-right {
|
||||
top: 0;
|
||||
}
|
||||
.bottom-right {
|
||||
bottom: 0;
|
||||
}
|
||||
.center {
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
.animation-wrapper {
|
||||
margin: 0 auto;
|
||||
&.animation-text{
|
||||
margin-top: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.owl-nav{
|
||||
button{
|
||||
visibility:hidden;
|
||||
opacity:0;
|
||||
.lib-css(transition, ~"all 200ms ease", @_prefix: 1);
|
||||
&.owl-next,
|
||||
&.owl-prev{
|
||||
z-index: 2;
|
||||
width: 49px;
|
||||
height: 74px;
|
||||
margin: -37px 0 0;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
background:#000000;
|
||||
&.disabled{
|
||||
opacity: 0.2;
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
}
|
||||
span{
|
||||
line-height: 30px;
|
||||
height: 30px;
|
||||
width: 16px;
|
||||
&:after,
|
||||
&:before{
|
||||
height: 20px;
|
||||
left: 7px;
|
||||
top: -2px;
|
||||
}
|
||||
&:after{
|
||||
top: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.owl-prev{
|
||||
transform: translateX(-20px);
|
||||
left: -10px;
|
||||
}
|
||||
&.owl-next{
|
||||
transform: translateX(20px);
|
||||
right:-10px;
|
||||
span{
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-banner__nav-always,
|
||||
&:hover{
|
||||
.owl-nav{
|
||||
button{
|
||||
visibility:visible;
|
||||
opacity:1;
|
||||
&.owl-prev,
|
||||
&.owl-next{
|
||||
transform:translateX(0px);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Banner Title and Links
|
||||
// _____________________________________________
|
||||
|
||||
.ox-banner__text-container {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
margin: 17px 14px;
|
||||
display: none;
|
||||
br {
|
||||
clear:both;
|
||||
height:0;
|
||||
line-height: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.text {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
line-height:28px;
|
||||
padding:4px 8px 6px;
|
||||
margin: -8px 0 0;
|
||||
color:#fff;
|
||||
background-color:#000000;
|
||||
font-size:31px;
|
||||
font-weight:800;
|
||||
text-transform:uppercase;
|
||||
white-space: nowrap;
|
||||
-webkit-transform: translateZ(0);
|
||||
.lib-css(transition, ~"all 256ms cubic-bezier(0.330, 0.975, 0.245, 0.910)", @_prefix: 1);
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
&:before,
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
:before {
|
||||
width: 100%;
|
||||
}
|
||||
&:after{
|
||||
background-color:@athlete-banner-slider__main-color;
|
||||
.lib-css(transition, ~"all 256ms cubic-bezier(0.330, 0.975, 0.245, 0.910)", @_prefix: 1);
|
||||
}
|
||||
}
|
||||
.link {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding: 6px 8px;
|
||||
margin:0 3px 0 6px;
|
||||
font-style: normal;
|
||||
line-height:1;
|
||||
white-space: nowrap;
|
||||
-webkit-transform: translateZ(0);
|
||||
font-weight: @font-weight__bold;
|
||||
font-size: 12px!important;
|
||||
color:#000000;
|
||||
background-color:@athlete-banner-slider__main-color;
|
||||
}
|
||||
.animation-wrapper {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
overflow: hidden;
|
||||
margin: -8px 0 0;
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
.animation-link {
|
||||
margin-top: 0;
|
||||
}
|
||||
.animate-me .text{
|
||||
color:#000000;
|
||||
&:after {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-banner-medium{
|
||||
.ox-banner__text-container{
|
||||
margin: 40px;
|
||||
.link{
|
||||
padding: 8px 11px;
|
||||
font-weight: @font-weight__black;
|
||||
font-size: 14px!important;
|
||||
margin-left: 12px;
|
||||
}
|
||||
.text {
|
||||
padding:10px 12px;
|
||||
font-size:36px;
|
||||
line-height:34px;
|
||||
}
|
||||
.animation-wrapper {
|
||||
margin-top: -10px;
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
&.animation-link{
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ox-banners-slider__container{
|
||||
.center {
|
||||
.ox-banner__text-container{
|
||||
.link{
|
||||
margin-left:0;
|
||||
margin-right:0;
|
||||
}
|
||||
}
|
||||
.animation-wrapper {
|
||||
&.animation-text{
|
||||
margin-top: -12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// Banner Hovers
|
||||
// _____________________________________________
|
||||
|
||||
@media only screen and (min-width: 1025px) {
|
||||
.ox-banners-slider__container{
|
||||
.ox-banner__banners{
|
||||
.ox-banner__slide{
|
||||
.ox-banner__link-wrapper{
|
||||
&:hover{
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-banner__hover-zoom{
|
||||
.ox-banner__banners{
|
||||
.ox-banner__slide{
|
||||
&:hover{
|
||||
.ox-banner-slider__image{
|
||||
-webkit-transform:scale(1.1) !important;
|
||||
-moz-transform:scale(1.1) !important;
|
||||
-o-transform:scale(1.1) !important;
|
||||
transform:scale(1.1) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&.ox-banner-medium{
|
||||
&.ox-banner__hover-zoom{
|
||||
.ox-banner__banners{
|
||||
.ox-banner__slide{
|
||||
&:hover{
|
||||
.ox-banner-slider__image{
|
||||
-webkit-transform:scale(1.05) !important;
|
||||
-moz-transform:scale(1.05) !important;
|
||||
-o-transform:scale(1.05) !important;
|
||||
transform:scale(1.05) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
|
||||
.ox-banner__text-container {
|
||||
.link {
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user