Commit ed1bf3c0 authored by lixy's avatar lixy

热门旅游、车型、活动触顶固定

parent e7024a00
...@@ -25,14 +25,18 @@ ...@@ -25,14 +25,18 @@
<h3 class="content-t content-t-l" style="text-align: left;">活动详情</h3> <h3 class="content-t content-t-l" style="text-align: left;">活动详情</h3>
<div class="models-details" v-html="detail.content"></div> <div class="models-details" v-html="detail.content"></div>
</div> </div>
<div class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 0 20px 20px 20px;"> <div id = "fixContainer" class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 0 20px 20px 20px;">
<h3 class="content-t hot-t-r">热门活动</h3> <div id="activityHotId" :class="barFixed?'isFixed':''">
<h3 class="content-t hot-t-r">热门活动</h3>
<!--<div class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 0 20px 20px 20px;">-->
<!--<h3 class="content-t hot-t-r">热门活动</h3>-->
<div class="content-detail tc" v-for="item in hotList" :key="item.id"> <div class="content-detail tc" v-for="item in hotList" :key="item.id">
<img :src="item.banner" :alt="item.title" style="width: 190px;height: 120px;"/> <img :src="item.banner" :alt="item.title" style="width: 190px;height: 120px;"/>
<div class="tc ellipsis cc-title">{{item.title}}</div> <div class="tc ellipsis cc-title">{{item.title}}</div>
<nuxt-link :to="'/activityList/'+item.id"><div class="detail-new">活动详情</div></nuxt-link> <nuxt-link :to="'/activityList/'+item.id"><div class="detail-new">活动详情</div></nuxt-link>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -59,6 +63,12 @@ ...@@ -59,6 +63,12 @@
return{ return{
lengthPic:0, lengthPic:0,
preIndex: 0,//当前轮播选中图 preIndex: 0,//当前轮播选中图
barFixed: false
}
},
created() {
if (typeof window !== 'undefined') {
window.addEventListener('scroll', this.handleScroll);
} }
}, },
validate ({ params }) { validate ({ params }) {
...@@ -83,6 +93,23 @@ ...@@ -83,6 +93,23 @@
console.log(this.lengthPic); console.log(this.lengthPic);
}, },
handleScroll: function () {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
let path = $nuxt.$route.path;
if(path.indexOf('/activityList') != -1 ){
var menuTop = document.querySelector('#activityHotId').offsetTop;
console.log(menuTop+"--"+scrollTop);
//滑动到指定位置菜单吸顶
if (scrollTop > menuTop-120) {
this.barFixed = true;
}
let fixContainer = document.querySelector('#fixContainer').offsetTop;
if(scrollTop<fixContainer-120){
this.barFixed = false;
// this.tabIndex = 0;
}
}
},
}, },
mounted(){ mounted(){
let t = this; let t = this;
...@@ -117,14 +144,11 @@ ...@@ -117,14 +144,11 @@
} }
</script> </script>
<style scoped> <style scoped>
.is-fixed{ .isFixed{
position: fixed; position: fixed;
width: 1200px; top: 120px;
width: 300px;
background: #fff; background: #fff;
border-bottom: 10px solid #ccc;
margin-left: -30px;
padding-left: 0;
top: 90px;
} }
.tc { .tc {
text-align: center; text-align: center;
......
...@@ -142,14 +142,18 @@ ...@@ -142,14 +142,18 @@
<div v-html="notice[0].value"> <div v-html="notice[0].value">
</div> </div>
</div> </div>
<div style="float:left;width:300px;margin-left:20px;background-color:#fff;text-align:center"> <div id = "fixContainer" class="hot-r-campsite" style="float:left;width:300px;margin-left:20px;background-color:#fff;text-align:center">
<h3 style="height:53px;font-weight:400;line-height:53px;border-bottom:1px solid #EEEEEE;font-size:16px">热门旅行</h3> <div id="tourHotId" :class="barFixed?'isFixed':''">
<h3 style="height:53px;font-weight:400;line-height:53px;border-bottom:1px solid #EEEEEE;font-size:16px">热门旅行</h3>
<!--<div style="float:left;width:300px;margin-left:20px;background-color:#fff;text-align:center">-->
<!--<h3 style="height:53px;font-weight:400;line-height:53px;border-bottom:1px solid #EEEEEE;font-size:16px">热门旅行</h3>-->
<div v-for="(item,index) in hotList" :key="index" style="width:100%;padding:25px 60px 0 60px"> <div v-for="(item,index) in hotList" :key="index" style="width:100%;padding:25px 60px 0 60px">
<img :src="item.cover" alt="" style="width:180px;height:135px"> <img :src="item.cover" alt="" style="width:180px;height:135px">
<h5 style="overflow: hidden;text-overflow:ellipsis;margin:21px 0 30px 0;font-weight:400;font-size:16px;white-space: nowrap;">{{item.name}}</h5> <h5 style="overflow: hidden;text-overflow:ellipsis;margin:21px 0 30px 0;font-weight:400;font-size:16px;white-space: nowrap;">{{item.name}}</h5>
<nuxt-link :to="item.link"><button class="buttonDetail" style="font-size:14px;margin-bottom:57px" >旅游详情</button></nuxt-link> <nuxt-link :to="item.link"><button class="buttonDetail" style="font-size:14px;margin-bottom:57px" >旅游详情</button></nuxt-link>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -180,9 +184,14 @@ export default { ...@@ -180,9 +184,14 @@ export default {
lengthPic: 0, lengthPic: 0,
preIndex: 0, //当前轮播选中图 preIndex: 0, //当前轮播选中图
visible: false, visible: false,
barFixed: false
}; };
}, },
created() {
if (typeof window !== 'undefined') {
window.addEventListener('scroll', this.handleScroll);
}
},
validate({ params }) { validate({ params }) {
console.log(params.id); console.log(params.id);
return !isNaN(+params.id); return !isNaN(+params.id);
...@@ -248,6 +257,23 @@ export default { ...@@ -248,6 +257,23 @@ export default {
visiblePic() { visiblePic() {
this.visible = !this.visible; this.visible = !this.visible;
}, },
handleScroll: function () {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
let path = $nuxt.$route.path;
if(path.indexOf('/tourDetail') != -1 ){
var menuTop = document.querySelector('#tourHotId').offsetTop;
console.log(menuTop+"--"+scrollTop);
//滑动到指定位置菜单吸顶
if (scrollTop > menuTop-120) {
this.barFixed = true;
}
let fixContainer = document.querySelector('#fixContainer').offsetTop;
if(scrollTop<fixContainer-120){
this.barFixed = false;
// this.tabIndex = 0;
}
}
},
}, },
mounted() { mounted() {
let t = this; let t = this;
...@@ -286,6 +312,12 @@ export default { ...@@ -286,6 +312,12 @@ export default {
</script> </script>
<style scoped> <style scoped>
.isFixed{
position: fixed;
top: 120px;
width: 300px;
background: #fff;
}
.clearfix:after { .clearfix:after {
/*伪元素是行内元素 正常浏览器清除浮动方法*/ /*伪元素是行内元素 正常浏览器清除浮动方法*/
content: ""; content: "";
......
...@@ -85,14 +85,18 @@ ...@@ -85,14 +85,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 20px;"> <div id = "fixContainer" class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 20px;">
<h3 class="content-t hot-t-r">热门车型</h3> <div id="vehicleHotId" :class="barFixed?'isFixed':''">
<h3 class="content-t hot-t-r">热门车型</h3>
<!--<div class="content-r-link" style="width: 300px;background: #fff;margin: 20px 0;padding: 20px;">-->
<!--<h3 class="content-t hot-t-r">热门车型</h3>-->
<div class="content-detail tc" v-for="item in hotList" :key="item.id"> <div class="content-detail tc" v-for="item in hotList" :key="item.id">
<img :src="item.coverPic" :alt="item.name" style="width: 161px;height: 116px;"/> <img :src="item.coverPic" :alt="item.name" style="width: 161px;height: 116px;"/>
<div class="tc ellipsis cc-title">{{item.name}}</div> <div class="tc ellipsis cc-title">{{item.name}}</div>
<nuxt-link :to="item.link"><div class="detail-new">租车详情</div></nuxt-link> <nuxt-link :to="item.link"><div class="detail-new">租车详情</div></nuxt-link>
</div> </div>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -120,6 +124,12 @@ ...@@ -120,6 +124,12 @@
isShowScan: false, isShowScan: false,
lengthPic:0, lengthPic:0,
preIndex: 0,//当前轮播选中图 preIndex: 0,//当前轮播选中图
barFixed: false
}
},
created() {
if (typeof window !== 'undefined') {
window.addEventListener('scroll', this.handleScroll);
} }
}, },
validate ({ params }) { validate ({ params }) {
...@@ -166,6 +176,23 @@ ...@@ -166,6 +176,23 @@
showScan(){ showScan(){
this.isShowScan = !this.isShowScan; this.isShowScan = !this.isShowScan;
}, },
handleScroll: function () {
let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
let path = $nuxt.$route.path;
if(path.indexOf('/vehicleList') != -1 ){
var menuTop = document.querySelector('#vehicleHotId').offsetTop;
console.log(menuTop+"--"+scrollTop);
//滑动到指定位置菜单吸顶
if (scrollTop > menuTop-120) {
this.barFixed = true;
}
let fixContainer = document.querySelector('#fixContainer').offsetTop;
if(scrollTop<fixContainer-120){
this.barFixed = false;
// this.tabIndex = 0;
}
}
},
}, },
mounted(){ mounted(){
let t = this; let t = this;
...@@ -204,6 +231,12 @@ ...@@ -204,6 +231,12 @@
</script> </script>
<style scoped> <style scoped>
.isFixed{
position: fixed;
top: 120px;
width: 300px;
background: #fff;
}
.member-list{ .member-list{
color: #666; color: #666;
font-size: 14px; font-size: 14px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment