企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 专题页面常用布局 ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>城市页面</title> <link rel="stylesheet" href="./css/bootstrap.min.css"> <link rel="stylesheet" href="./css/bootstrap-theme.min.css"> <link rel="stylesheet" href="./css/iconfont.css"> <script src="js/jquery-3.3.1.min.js"></script> <script src="js/jquery.easing.min.js"></script> <script src="js/jquery.mousewheel.js"></script> <script src="js/bootstrap.min.js"></script> <style> * { margin: 0; padding: 0; } html,body { width: 100%; height: 100%; } .swiper_container { overflow: hidden; width: 100%; height: 100%; } .slide { width: 100%; } .swiper_show { width: 100%; height: 100%; position: relative; top: 0; left: 0; } .part1 { background-image: url('./image/qb.png'); background-size: 100% 100%; } .part2 { background: #fff; } .part3 { background: yellow; } .part4 { background: red; } .part5 { background: blue; } .part6 { background: green; } .part7 { background: bisque; } .swiper_list { position: fixed; top: 50%; left: 30px; transform: translateY(-50%); } .swiper_dot { display: block; width: 15px; height: 15px; line-height: 15px; text-align: center; margin-bottom: 5px; } .swiper_dot span { display: inline-block; width: 8px; height: 8px; background-color: #000; border-radius: 50%; transition: all ease 0.5s; } .swiper_dot span:hover { width: 10px; height: 10px; } .swiper_dot.active span { width: 12px; height: 12px; background-color: #fff; } .button_group { position: fixed; right: 0; top: 50%; transform: translateY(-50%); } .button .l-icon { display: block; width: 48px; height: 48px; text-align: center; text-decoration: none; line-height: 48px; background-color: #909399; font-size: 30px; color: #fff; } .button { margin: 2px 0; position: relative; display: block; } .button:hover { text-decoration: none; } .button.active { background-color: #000; } .l-qrcode { position: absolute; right: 48px; bottom: 0; } .l-qrcode img { width: 0; height: 0; transform-origin: right bottom; transform: scale(0); transition: all ease 0.5s; } .button[animate="show"]:hover .l-qrcode img { width: 120px; height: 120px; transform: scale(1); } .l-info { width: 74px; position: absolute; right: 58px; top: 50%; transform: translateY(-50%); font-size: 16px; text-align: center; } .l-info span { display: block; background-color: rgba(0,0,0, 0.6); padding: 5px; color: #fff; border-radius: 5px; visibility: hidden; opacity: 0; transition: all ease 0.5s; position: relative; } .l-info span[trangle]::before { content: ''; display: block; position: absolute; top: 50%; right: -16px; width: 0; height: 0; transform: translateY(-50%); border-top: 8px solid transparent; border-right: 8px solid transparent; border-left: 8px solid rgba(0,0,0,0.6); border-bottom: 8px solid transparent; } .button[animate="show"]:hover .l-info span{ opacity: 1; visibility: visible; } .button[animate="top"] { opacity: 0; visibility: hidden; } </style> </head> <body> <section class="swiper_container"> <div class="swiper_show"> <div class="slide part1"></div> <div class="slide part2"></div> <div class="slide part3"></div> <div class="slide part4"></div> <div class="slide part5"></div> <div class="slide part6"></div> <div class="slide part7"></div> </div> <!--轮播点--> <div class="swiper_list"> <div data-index='0' class="swiper_dot"><span></span></div> <div data-index="1" class="swiper_dot"><span></span></div> <div data-index="2" class="swiper_dot"><span></span></div> <div data-index="3" class="swiper_dot"><span></span></div> <div data-index="4" class="swiper_dot"><span></span></div> <div data-index="5" class="swiper_dot"><span></span></div> <div data-index="6" class="swiper_dot"><span></span></div> </div> </section> <div class="button_group"> <div animate="top" class="button"> <i class="l-icon iconfont icon-xiangshangjiantou"></i> </div> <a animate="show" class="button"> <i class="l-icon iconfont icon-liaotian"></i> <div class="l-info"> <span trangle>免费咨询</span> </div> </a> <div animate="show" class="button"> <i class="l-icon iconfont icon-erweima"></i> <div class="l-qrcode"> <img src="./image/qrcode.jpg" alt=""> </div> </div> </div> </body> <script> let FullPage = function () { // 初始化参数变量 let $height = this.$height = $('.swiper_container').height() let slide= $('.slide') slide.css({'height': $height}) let len = slide.length $('.swiper_show').css({"height": len * 974}) // 内置对象 let Scroll = function () { } // 页面翻滚函数 Scroll.prototype.start = function ($index, $height) { let offset = -$index * $height $(".swiper_show").queue('scroll', function (next) { $(this).animate({"top": offset+"px"}, 500, function () { FullPage.$tottle = true }) next() }) $('.swiper_show').dequeue('scroll') } // 检测$index函数 Scroll.prototype.isRightIndex = function ($index) { if($index < FullPage.$min) { return FullPage.$min; } if ($index > FullPage.$max) { return FullPage.$max; } // 记录$index FullPage.$index = $index return $index } // 回到顶部 Scroll.prototype.scrollTop = function (scroll, flag) { if (flag === 0) { FullPage.$index = 0 scroll.start(0, $height) console.log($('[animate="top"]')) $('[animate="top"]').queue('scrollTop',function (next) { $(this).animate({'opacity': 0}, { complete: function () { $(this).css({'visibility': 'hidden'}) } }) next() }).dequeue('scrollTop') } else { $('[animate="top"]').queue('scrollTop',function (next) { $(this).css({'visibility': 'visible'}).animate({'opacity': 1}) next() }).dequeue('scrollTop') } } // 轮播点图动画效果 Scroll.prototype.dotChange = function ($index) { $('.swiper_dot').removeClass('active') $($('.swiper_dot')[$index]).addClass('active') } let scroll = new Scroll() $('[animate="top"]').on('click', function () { scroll.scrollTop(scroll, 0) }) // 绑定轮播事件 this.init = function () { $('.swiper_show').mousewheel(function (event, delta) { let $index = FullPage.$index if(FullPage.$tottle) { FullPage.$tottle = false if(delta< 0) { // 向下翻滚 $index++ $index = scroll.isRightIndex($index) scroll.start($index, $height) scroll.scrollTop(scroll, $index) scroll.dotChange($index) } if(delta > 0) { // 向上翻滚 $index-- $index = scroll.isRightIndex($index) scroll.start($index, $height) scroll.scrollTop(scroll, $index) scroll.dotChange($index) } } }) } this.init() } // 对象全局变量 FullPage.$index = 0 FullPage.$tottle = true FullPage.$max = 6 FullPage.$min = 0 new FullPage() </script> </html> ~~~