Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -5,6 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer');
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
... ... @@ -15,6 +16,8 @@ var searchH = $('.newbrand-search').height(),
headerH = $('.yoho-header').height(),
brandSwipe = parseInt(searchH) + parseInt(headerH);
var myHammer;
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
... ... @@ -49,11 +52,19 @@ if ($brandList.length > 0) {
});
}
$('#right-bar .con').find('b').unbind().on('tap', function() {
// $('#right-bar .con').find('b').unbind().on('tap', function() {
// var index = $(this).index();
// if ($('.bar-' + index).size() > 0) {
// document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
// }
// });
myHammer = new Hammer($('#right-bar .con').find('b').unbind()[0]);
myHammer.on('tap', function(e) {
var index = $(this).index();
if ($('.bar-' + index).size() > 0) {
document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
}
});
... ...
... ... @@ -4,6 +4,7 @@
* @date: 2015/10/12
*/
var $ = require('jquery'),
Hammer = require('hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload'),
bannerSwiper,
... ... @@ -21,6 +22,8 @@ var requestFrame,
$logotrans = $('.home-header .logo'),
isen = true;
var navHammer, mobileWrapHammer, sideNavHammer;
require('./maybe-like');
lazyLoad($('img.lazy'));
... ... @@ -28,7 +31,24 @@ lazyLoad($('img.lazy'));
//$('img:in-viewport').trigger('appear');
//点击首页汉堡menu图标,滑出侧栏导航
$('.nav-btn').on('tap', function (event) {
// $('.nav-btn').on('tap', function (event) {
// if (!$(this).hasClass('menu-open')) {
// $('.mobile-wrap').addClass('menu-open');
// $('.overlay').show().css('opacity', 0.3);
// $('.side-nav').addClass('on');
// //设置boy高宽,页面不能上下滑动
// $('body').css({
// height: $(window).height(),
// width: '100%',
// overflow: 'hidden'
// });
// }
// event.stopPropagation();
// });
navHammer = new Hammer($('.nav-btn')[0]);
navHammer.on('tap', function(event) {
if (!$(this).hasClass('menu-open')) {
$('.mobile-wrap').addClass('menu-open');
$('.overlay').show().css('opacity', 0.3);
... ... @@ -45,7 +65,24 @@ $('.nav-btn').on('tap', function (event) {
});
//点击页面主体,收起侧栏导航及二级导航
$('.mobile-wrap').on('tap', function () {
// $('.mobile-wrap').on('tap', function () {
// if ($(this).hasClass('menu-open')) {
// $('.mobile-wrap').removeClass('menu-open');
// $('.overlay').css('opacity', 0);
// $('.sub-nav').removeClass('show');
// $('.side-nav').removeClass('on');
// $('body').css({
// height: 'auto',
// overflow: 'auto'
// });
// setTimeout(function() {
// $('.overlay').hide();
// }, 300);
// }
// });
mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
mobileWrapHammer.on('tap', function(event) {
if ($(this).hasClass('menu-open')) {
$('.mobile-wrap').removeClass('menu-open');
$('.overlay').css('opacity', 0);
... ... @@ -62,7 +99,7 @@ $('.mobile-wrap').on('tap', function () {
});
//点击一级导航,弹出二级导航
$('.side-nav').on('tap', 'li', function () {
$('.side-nav').on('touchstart', 'li', function () {
if ($(this).find('.sub-nav').size() > 0) {
$('.sub-nav').removeClass('show');
$(this).find('.sub-nav').addClass('show');
... ... @@ -71,7 +108,7 @@ $('.side-nav').on('tap', 'li', function () {
//返回一级导航,收起二级导航
$('.sub-nav').each(function () {
$(this).find('li').eq(0).on('tap', function (e) {
$(this).find('li').eq(0).on('touchstart', function (e) {
$('.sub-nav').removeClass('show');
e.stopPropagation();
});
... ...
... ... @@ -5,6 +5,7 @@
*/
var $ = require('jquery'),
Hammer = require('hammer'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho.lazyload');
... ... @@ -86,9 +87,11 @@ $(window).scroll(function () {
type: 'GET',
url: url,
success: function(data) {
$('#load-more-img').show();
$('#load-more-img a').attr('url', data[0].banner[0].url);
$('#load-more-img a > img').attr('src', data[0].banner[0].img);
if (data && data[0] && data[0].banner[0]) {
$('#load-more-img').show();
$('#load-more-img a').attr('url', data[0].banner[0].url);
$('#load-more-img a > img').attr('src', data[0].banner[0].img);
}
},
error: function() {
}
... ...
... ... @@ -4,12 +4,15 @@
* @date: 2015/10/26
*/
var $ = require('jquery');
var $ = require('jquery'),
Hammer = require('hammer');
var $searchBox = $('.search-box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo');
var floatLayerCloseHammer, floatLayerBtnHammer, clearTextHammer, searchIconHammer;
function downLoadApp() {
var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
var clickedAt = new Date();
... ... @@ -21,7 +24,21 @@ function downLoadApp() {
}, 500);
}
$('#float-layer-close').bind('tap', function () {
// $('#float-layer-close').bind('tap', function () {
// $('#float-layer-app').hide();
// window.setCookie('_float-layer-app', 'id490655927',
// {
// domain: '.yohobuy.com'
// });
// window.setCookie('_float-layer-app-close', 1,
// {
// domain: '.yohobuy.com',
// expires: 1
// });
// });
floatLayerCloseHammer = new Hammer($('#float-layer-close')[0]);
floatLayerCloseHammer.on('tap', function(e) {
$('#float-layer-app').hide();
window.setCookie('_float-layer-app', 'id490655927',
{
... ... @@ -34,7 +51,12 @@ $('#float-layer-close').bind('tap', function () {
});
});
$('#float-layer-btn').tap(function () {
// $('#float-layer-btn').tap(function () {
// downLoadApp('bottom');
// });
floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
floatLayerBtnHammer.on('tap', function(e) {
downLoadApp('bottom');
});
... ... @@ -76,10 +98,20 @@ $searchBox.find('input').on('focus', function () {
$('.clear-text, .no-search').hide();
});
$searchBox.find('.clear-text').tap(function () {
$searchBox.find('.clear-text').click(function () {
$searchBox.find('input').val('').trigger('focus');
});
$searchBox.find('.search-icon').tap(function () {
// clearTextHammer = new Hammer($searchBox.find('.clear-text')[0]);
// clearTextHammer.on('tap', function(e) {
// $searchBox.find('input').val('').trigger('focus');
// });
$searchBox.find('.search-icon').click(function () {
$indexSearch.submit();
});
\ No newline at end of file
});
// searchIconHammer = new Hammer($searchBox.find('.search-icon')[0]);
// searchIconHammer.on('tap', function(e) {
// $indexSearch.submit();
// });
\ No newline at end of file
... ...
... ... @@ -225,7 +225,7 @@ filter.registerCbFn(search);
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'tap', function() {
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
nav,
navType,
... ...
... ... @@ -252,7 +252,7 @@ filter.registerCbFn(search);
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'tap', function() {
$listNav.delegate('li', 'touchstart', function() {
var $this = $(this),
nav,
navType,
... ...
... ... @@ -8,7 +8,7 @@
</div>
<div class="load-more-img hide" id="load-more-img">
<a href="">
<img src="">
</a>
<a href="">
<img src="">
</a>
</div>
... ...