Browse Source

feat: 结构化数据落地页广告新增吸底

cuiyalong 3 years ago
parent
commit
b2ad270f01

+ 2 - 3
src/web/templates/pc/subscribe_new.html

@@ -45,7 +45,7 @@
       }
       .footer-banner {
           position: fixed;
-          z-index: 665;
+          z-index: 98;
           bottom: 0;
           left: 0;
           width: 100%;
@@ -584,8 +584,7 @@
             // 表格头部固定
             var tableHeaderDom = $('.sub-contrast')
             var tableHeaderChangeDom = $(".contrast-main-header[data-sticky-change]")
-            var tableMaxHeight = $(".contrast-main").height() + $(".contrast-main").offset().top - tableHeaderChangeDom.height()
-
+            var tableMaxHeight = $(".contrast-main").height() + $(".contrast-main").offset().top - 64 - tableHeaderChangeDom.height()
             if ($(window).scrollTop() > tableHeaderDom.offset().top && $(window).scrollTop() < tableMaxHeight) {
                 tableHeaderChangeDom.show()
             } else {

+ 27 - 37
src/web/templates/structuredata/pc/index.html

@@ -294,6 +294,7 @@
 <script src='{{Msg "seo" "cdn"}}/common-module/pc-dialog/js/leave-info-dialog.js?v={{Msg "seo" "version"}}'></script>
 <script src='{{Msg "seo" "cdn"}}/structuredata/pc/js/index.js?v={{Msg "seo" "version"}}'></script>
 <script>
+    var needMoreAdShow = true
     $(function () {
         $("#backTop").remove();
         haslogin({{.T.logid}});
@@ -303,43 +304,6 @@
         if (source!=null){
             typ = typ + "-" + source;
         }
-        // $("#data_example").on("click",function(){
-        //     try {
-        //         _hmt.push(['_trackEvent',typ, 'click', "点击查看数据实例"]);
-        //     } catch (e) {
-        //         console.log('未初始化百度统计', e)
-        //     }
-        //     window.open("/front/structed/getpreview", '_blank')
-        // })
-
-        // $('.bottom_btn').on('click', function(){
-        //     var className=$(this).attr("class");
-        //     var baidutj="";
-        //     if((className.indexOf("consult"))>-1){ //立即咨询1
-        //         baidutj="立即咨询-1";
-        //     } else if ((className.indexOf("experience"))>-1){//抢鲜体验
-        //         baidutj="抢先体验结构化数据";
-        //     } else if ((className.indexOf("canfirst"))>-1){ //立即咨询2
-        //         baidutj="立即咨询-2";
-        //     } else if ((className.indexOf("company"))>-1){ //立即使用
-        //         baidutj="立即使用";
-        //     }
-        //     if (loginflag){
-        //         var href='/front/structed/pc_info.html'
-        //         var source = getParam("source");
-        //         if (source!=null){
-        //             href+="?source="+source;
-        //         }
-        //         try {
-        //             _hmt.push(['_trackEvent',typ, 'click', baidutj]);
-        //         } catch (e) {
-        //             console.log('未初始化百度统计', e);
-        //         }
-        //         window.open(href, '_blank')
-        //     }else{
-        //         $("#bidLogin").modal("show");
-        //     }
-        // })
 
         // 获取数据样例
         $('.get-data-example, .get-data-example-button').on('click', function () {
@@ -367,9 +331,35 @@
         // 底部ad
         $('.i-need-more .closed').on('click', function () {
             $('.i-need-more').fadeOut()
+            needMoreAdShow = false
         })
+
+        windowScrollFn()
+        $(window).on('scroll', windowScrollFn)
+        $(window).on('resize', windowScrollFn)
     })
 
+    function windowScrollFn () {
+        // 底部横幅固定
+        var stickyFooter = $('.i-need-more')
+        if (needMoreAdShow) {
+            // 吸底
+            // 如果距离底部
+            var bottomFooter = $('.j-bottom')
+            var ob = { top: 0 }
+                if (bottomFooter.length) {
+                ob = bottomFooter[0] && bottomFooter[0].getBoundingClientRect()
+            }
+            // bottom出现在视口
+            var bottom = window.innerHeight - ob.top
+            if (bottom > 0 && ob.top !== 0) {
+                stickyFooter.css({ bottom: parseInt(bottom) })
+            } else {
+                stickyFooter.css({ bottom: 0 })
+            }
+        }
+    }
+
     /******* 获取url参数(正则)********/
     function getParam(name) {
       var search = document.location.search;