Authored by 郭成尧

'scrollBar临时解决方案'

... ... @@ -13,12 +13,19 @@
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html,
body {
html {
height: 100%;
width: 100%;
overflow: hidden;
body {
width: 100%;
height: 100%;
overflow-y: scroll;
font-size: 24px;
font-family: "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
line-height: 1.4;
}
}
/* stylelint-disable */
... ...
... ... @@ -140,14 +140,16 @@
let ghost2 = false;
let ghost3 = false;
if (window.scrollY > 40) {
let myHeaderTop = $('.my-header').offset().top;
if (myHeaderTop < -40) {
ghost = false;
ghost2 = false;
ghost3 = false;
} else if (window.scrollY > 25) {
} else if (myHeaderTop < -25) {
ghost = false;
ghost3 = true;
} else if (window.scrollY > 10) {
} else if (myHeaderTop < -10) {
ghost = false;
ghost2 = true;
}
... ... @@ -165,15 +167,17 @@
return false;
});
window.addEventListener('touchmove', () => {
let body = $('body');
body.on('touchmove', () => {
this.toggle();
});
window.addEventListener('scroll', () => {
body.on('scroll', () => {
this.toggle();
});
document.addEventListener('visibilitychange', () => {
body.on('visibilitychange', () => {
if (!document.hidden) {
this.reload();
}
... ...
... ... @@ -19,6 +19,7 @@
<script>
const yoho = require('yoho');
const cheader = require('component/header.vue');
const $ = require('jquery');
module.exports = {
data() {
... ... @@ -45,15 +46,15 @@
},
created() {
window.onscroll = () => {
$('body').on('scroll', () => {
let transparent = true;
if (window.scrollY > 20 ) {
if ($('.image-carousel').offset().top < -20) {
transparent = false;
}
this.$refs.header.$el.classList.toggle('ghost', transparent);
}
});
}
};
</script>
... ...
<template>
<cheader :title="title" :class="{ghost: shareData.isBlkShop}" :fixed="shareData.isBlkShop" v-ref:header>
<template slot="right">
<template slot="right" v-on:scroll="">
<span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()">&#xe60d;</span>
<span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()">&#xe60c;</span>
<span v-if="shareData.isBlkShop" class="icon" @click="goShare()">&#xe60e;</span>
... ... @@ -53,10 +53,11 @@
// 删除两个多余的参数,两个参数是收藏时使用的
delete this.shareData.shopId;
delete this.shareData.isFav;
yoho.goShare(this.shareData, function() {}, function() {});
yoho.goShare(this.shareData);
},
goBack() {
yoho.goBack({}, function() {}, function() {});
yoho.goBack();
},
/* 收藏或者取消收藏店铺 */
... ... @@ -85,9 +86,9 @@
},
changeTopStatus() {
let topChange = true;
let topHeight = document.body.scrollTop;
let topHeight = $('.brand-top-box').offset().top;
if (topHeight > 100) {
if (topHeight < -200) {
topChange = false;
}
... ... @@ -98,7 +99,7 @@
this.domain = this.shareData.domain;
if (this.shareData.isBlkShop) {
window.onscroll = this.changeTopStatus;
$('body').on('scroll', this.changeTopStatus);
}
}
};
... ...