浏览代码

style: 顶部广告同步

zhangyuhan 2 年之前
父节点
当前提交
2a5d199c12
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 3 3
      src/web/staticres/public-pc/css/header-nav.css
  2. 6 2
      src/web/staticres/public-pc/js/header-nav.js

+ 3 - 3
src/web/staticres/public-pc/css/header-nav.css

@@ -49,7 +49,7 @@
 .advertising_position_index .one,
 .advertising_position_brand .one {
   width: 50%;
-  /* height: 80px; */
+   height: 80px;
   position: absolute;
   left: 0;
   top: 0;
@@ -58,8 +58,8 @@
 
 .advertising_position_index .two,
 .advertising_position_brand .two {
-  width: 52%;
-  /* height: 80px; */
+  width: 50%;
+  height: 80px;
   position: absolute;
   right: 0;
   top: 0;

+ 6 - 2
src/web/staticres/public-pc/js/header-nav.js

@@ -60,7 +60,7 @@ function trySelectNav (name) {
   try {
     // if(name == '解决方案') {
     //   name = '电信行业解决方案'
-    // } 
+    // }
     var activeDom = document.querySelector("#public-nav .jynav li .jynav-list span[name='"+ name +"']")
     if (activeDom) {
       console.log(activeDom)
@@ -70,7 +70,7 @@ function trySelectNav (name) {
       var activeLi = document.querySelector("#public-nav .jynav li[name='"+ name +"']")
       if(activeLi){
         activeLi.className += ' active'
-      } 
+      }
     }
     var newactiveDom = document.querySelector("#public-nav .jynav li .case-row-group a[name='"+ name +"']")
     if(newactiveDom){
@@ -350,6 +350,10 @@ fixScaleScroll()
 function fixScaleScroll () {
   $(window).on('scroll', function () {
     var scrollLeft = $('html').scrollLeft()
+    var hasAdOfTop = $(".advertising_position").children().length
     $('#public-nav .iner').css({ transform: 'translateX(-' + scrollLeft + 'px)' })
+    if (hasAdOfTop) {
+      $(".advertising_position").css({ transform: 'translateX(-' + scrollLeft + 'px)' })
+    }
   })
 }