zoukankan      html  css  js  c++  java
  • 记录-关于网站的欢迎页,初次进入可见欢迎页,再次进入就直接显示主页了

    需求:

    第一次进入网站需要进入的是欢迎页(引导页),再次进入就直接进入主页了。

    想到的是cookie 保持本地文件。

    jquery cookie;(需要在页面引入jquery cookie插件)

    附上部分代码参考:

    $(function(){
    
    //对浏览器的cookie进行判断,有cookie说明已经创建,这里取反直接进入主页
    if(!$.cookie('hasWatch')){
    $("#homeShufflingImage").append('<div class="swiper-slide" style="text-align: center; auto"><img src="../res/vankemobilestyle/images/guide01.jpg" width="100%"/></div>'
    +'<div class="swiper-slide" style="text-align: center; auto"><img alt="" src="../res/vankemobilestyle/images/guide02.jpg" width="100%" /></div>'
    +'<div class="swiper-slide" style="text-align: center; auto"><img alt="" src="../res/vankemobilestyle/images/guide03.jpg" width="100%" /></div>'
    +'<div class="swiper-slide" style="text-align: center; auto"><img alt="" src="../res/vankemobilestyle/images/guide04.jpg" width="100%" /></div>'
    +'<div class="swiper-slide" style="text-align: center; auto"><a href="/webMoblie/mbNewHouse" style="height:100%;"><img alt="" src="../res/vankemobilestyle/images/guide05.png" width="100%" /></a></div>'
    
    );
    
    var swiper = new Swiper('.index_roll .swiper-container', {
    pagination: '.swiper-pagination',
    paginationClickable: true,
    centeredSlides: true,
    autoplayDisableOnInteraction: false,
    autoplay:false
    });
    
    $(".swiper-slide img").height($(window).height());
    //此处重点:创建jquery cookie $.cookie('hasWatch', 'ture', { expires: 100, path: '/' }); } else window.location.href ='/webMoblie/mbIndex'; })
  • 相关阅读:
    小程序自动更新版本
    js深浅拷贝理解
    小程序模仿toast效果
    小程序button默认border
    Java利用POI 读取Excel行列数,坑
    Nginx 极简入门教程
    七、SpringBoot整合持久化层,配置多数据源(SpringBoot系列)
    六、SpringBoot整合aop(SpringBoot系列)
    五、SpringBoot随系统启动任务的方式(SpringBoot系列)
    四、SpringBoot通过CORS解决跨域问题(SpringBoot系列)
  • 原文地址:https://www.cnblogs.com/dscs/p/5005676.html
Copyright © 2011-2022 走看看