Authored by 2586703@qq.com

搜索js修改

... ... @@ -13,6 +13,7 @@
<body>
<div class="mobile-wrap">
<div class="hd">
<div class="header-download-wrap">
<div class="header-download clearfix">
<div class="tip-pic"></div>
<div class="tip-info">
... ... @@ -22,6 +23,7 @@
</div>
<span class="tip-close"></span>
</div>
</div>
<h1 class="logo iconfont"><a class="back-btn iconfont" href="javascript:;">&#xe60f;</a>&#xe60b;</h1>
</div>
<div class="bd">
... ... @@ -115,7 +117,7 @@
<script type="text/javascript" src="../../../res/js/lib/seajs.js"></script>
<script type="text/javascript">
seajs.use(['zepto', 'mobile'],function($, mobile){
//mobile.common();
mobile.common();
mobile.brand();
})
</script>
... ...
... ... @@ -19,16 +19,21 @@ define('mobile', function(require, exports) {
if ($('.header-download').size() > 0) {
downloadH = $('.header-download').height();
//顶部app下载位置
console.log(!$('.search-wrap input').hasClass('show'));
$(window).on('scroll', function() {
scrollTop = $(window).scrollTop();
if (scrollTop >= downloadH) {
$('.header-download').addClass('fix');
$('.header-download-wrap').addClass('show');
} else {
$('.header-download').removeClass('fix');
$('.header-download-wrap').removeClass('show');
if (!$('.search-wrap input').hasClass('show')) {
if (scrollTop >= downloadH) {
$('.header-download').addClass('fix');
$('.header-download-wrap').addClass('show');
} else {
$('.header-download').removeClass('fix');
$('.header-download-wrap').removeClass('show');
}
}
});
}
};
... ... @@ -107,12 +112,13 @@ define('mobile', function(require, exports) {
$('.search-wrap input').on('focus', function() {
var offsetTop = $('.search-wrap').offset().top;
$('.overlay').addClass('show');
if ($('.header-download').hasClass('fix')) {
offsetTop = $('.header-download').outerHeight();
}
$(this).removeClass('show').addClass('show');
$('body,html').animate({
scrollTop: offsetTop
});
});
$('.search-wrap').find('input').on('keyup', function(event) {
var keycode = event.which;
... ... @@ -233,4 +239,4 @@ define('mobile', function(require, exports) {
window.location.href = $(this).val();
})
};
});
});
\ No newline at end of file
... ...