Authored by 周少峰

Merge branch 'release/newProduct'

... ... @@ -4,7 +4,7 @@
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image src 378 175}}" alt="">
<img data-original="{{image src 378 175}}" src="{{image src 378 175}}" alt="">
</a>
</li>
{{/ imgBrand}}
... ...
... ... @@ -8,7 +8,9 @@
<ul class="img-list">
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank"> <img class="lazy" data-original="{{image src 320 430}}" alt="{{alt}}"></a>
<a href="{{url}}" target= "_blank">
<img data-original="{{image src 320 430}}" src="{{image src 320 430}}" alt="{{alt}}">
</a>
</li>
{{/ imgBrand}}
</ul>
... ...
... ... @@ -4,10 +4,7 @@
* @date: 2015/11/23
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var imageBrand = require('./img-brand');
var $ = require('yoho-jquery');
var homePage = $('.home-page').data('page'),
brandUrl = $('.logo-brand').data('url');
... ... @@ -19,6 +16,8 @@ require('../product/index/logo-brand');
require('../plugins/accordion');
require('../common/center-slider');
$(document).on('mouseenter', '.imgopacity a img', function() {
$(this).css('opacity', 0.8); // eslint-disable-line
});
... ... @@ -42,7 +41,7 @@ if ($.inArray(homePage, ['boys', 'girls', 'kids', 'lifestyle']) > -1) {
lazyLoad($('img.lazy'));
// lazyLoad($('img.lazy'));
if (homePage === 'boys') {
$('.slide-container').slider({
pagination: '.thumb-pagination'
... ... @@ -57,11 +56,11 @@ if (homePage === 'boys') {
url: brandUrl
});
imageBrand.init('.img-brand');
$('.img-brand').slider2({autoplay: true});
} else {
$('.logo-brand').logoBrand({
showNum: 10,
url: brandUrl
});
imageBrand.init('.img-slider-wrapper');
$('.img-slider-wrapper').slider2({autoplay: true});
}
... ...
... ... @@ -3,7 +3,7 @@ var $ = require('yoho-jquery'),
require('yoho-slider');
exports.init = function(selector) {
exports.init = function(selector, isAuto) {
var $imgBrand = $(selector);
var slider = $imgBrand.unslider({
delay: 5000,
... ... @@ -12,6 +12,7 @@ exports.init = function(selector) {
});
var imgBrandNum = $imgBrand.find('li').length;
var cols = imgBrandNum / 3;
var timer;
if (!($imgBrand.find('li').length % 3)) {
cols -= 1;
... ... @@ -46,4 +47,23 @@ exports.init = function(selector) {
slider.unslider('next');
}
});
function autoSlider() {
timer = setInterval(function() {
if (slider.data('unslider').current >= cols) {
slider.unslider('animate:first');
} else {
slider.unslider('next');
}
}, 2000);
}
if (isAuto) {
autoSlider();
$imgBrand.hover(function() {
clearInterval(timer);
}, function() {
autoSlider();
});
}
};
... ...
/**
* (品牌优选)图片幻灯片插件
* @author: wangqing(robin.wang@yoho.cn)
* @date: 205/7/2
*/
(function($) {
$.fn.slider2 = function(options) {
var timer;
function autoplayrecycle(index, limit, toright) {
window.setTimeout(autoplay, $.fn.slider2.defaults.delaytime, index, limit, toright);// eslint-disable-line
}
function autoplay(index, limit, toright) {
if (toright === true) {
$('.img-brand-switch .next').trigger('click');
if (index === (limit - 3)) {
autoplayrecycle(--index, limit, false);
} else {
autoplayrecycle(++index, limit, true);
}
} else {
$('.img-brand-switch .prev').trigger('click');
if (index === 0) {
autoplayrecycle(++index, limit, true);
} else {
autoplayrecycle(--index, limit, false);
}
}
}
function autoClickNext(dom) {
var delaytime = 'delaytime' in options ? options.delaytime :
$.fn.slider2.defaults.delaytime;
timer = setInterval(function() {
dom.find('.next').click();
}, delaytime);
}
function changePic(index, width, callback) {
var offersetleft = -(index * width);
$('.img-list')
.animate({
'margin-left': offersetleft + 'px'
}, 'slow', callback);
}
$.fn.slider2.defaults = {
index: 0,
shownum: 3,
autoplay: false,
delaytime: 3000
};
return this.each(function() {
var opts = $.extend({}, $.fn.slider2.defaults, options);
var mr = parseInt($('.img-item').css('margin-right'), 10);
var $banneritems = $('.img-item');
var bannerarr = [];
var _width = $banneritems.outerWidth() + mr,
_size = $banneritems.length,
j = 0;
if (_size <= 3) {
$(this).find('.img-brand-switch').hide();
return;
}
for (j = 0; j < $banneritems.length; j++) {
bannerarr.push($banneritems[j]);
}
_size = bannerarr.length;
$(this).find('.img-list').css({
width: (_width * _size)
});
$(this).find('.next').on('click', function(e) {
var i = 0,
_obj = null;
e.preventDefault();
changePic(3, _width, function() {
for (i = 0; i < 3; i++) {
_obj = bannerarr.shift();
$('.img-item').parent().append(_obj.outerHTML);
bannerarr.push(_obj);
}
$('.img-item').first().remove();
$('.img-item').first().remove();
$('.img-item').first().remove();
$('.img-list').css({
'margin-left': '0'
});
});
});
$(this).find('.prev').on('click', function(e) {
var i = 0,
_obj = null,
offersetleft = '';
e.preventDefault();
for (i = 0; i < 3; i++) {
_obj = bannerarr.pop();
$('.img-item').parent().prepend(_obj.outerHTML);
bannerarr.unshift(_obj);
}
offersetleft = 3 * _width;
$('.img-item').last().remove();
$('.img-item').last().remove();
$('.img-item').last().remove();
$('.img-list').css({
'margin-left': -offersetleft + 'px'
});
changePic(0, _width);
});
if (opts.autoplay === true) {
// autoplayrecycle(opts.index, _size, true);
autoClickNext($(this));
$(this).hover(function() {
clearInterval(timer);
}, function() {
autoClickNext($(this));
});
}
});
};
}($));
... ...
... ... @@ -92,7 +92,11 @@
}
.new-festival-tag {
background: #000;
width: 72px;
text-align: center;
background-image: resolve("product/newPro-icon.png");
color: #000;
padding: 0;
}
.yep-tag,
... ... @@ -982,6 +986,7 @@
.service {
$service: product/service.png;
width: width($service);
height: height($service);
margin: 45px auto;
... ...
... ... @@ -36,7 +36,7 @@
text-align: center;
top: 0;
position: absolute;
background: resolve('product/sale-out-bg.png');
background: resolve("product/sale-out-bg.png");
}
.sale-out-tip {
... ... @@ -44,7 +44,7 @@
height: 110px;
margin-top: 105px;
display: inline-block;
background: resolve('product/sale-out-tip.png') no-repeat center center;
background: resolve("product/sale-out-tip.png") no-repeat center center;
text-indent: -9999px;
}
}
... ... @@ -85,10 +85,9 @@
font-size: 12px;
color: #fff;
padding: 0 6px 0 16px;
background: resolve('product/discount-tag.png') no-repeat;
background: resolve("product/discount-tag.png") no-repeat;
display: inline-block;
}
}
.col-btn {
... ... @@ -131,7 +130,11 @@
}
.new-festival-tag {
background: #000;
width: 72px;
text-align: center;
background-image: resolve("product/newPro-icon.png");
color: #000;
padding: 0;
}
.yep-tag,
... ... @@ -151,6 +154,7 @@
from {
max-width: 0;
}
to {
max-width: 150px;
}
... ...