Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何在页面加载时将引导模式转换为弹出窗口?_Jquery_Bootstrap 4 - Fatal编程技术网

Jquery 如何在页面加载时将引导模式转换为弹出窗口?

Jquery 如何在页面加载时将引导模式转换为弹出窗口?,jquery,bootstrap-4,Jquery,Bootstrap 4,我需要把一个弹出窗口到一个网站上,告诉用户有一个新版本的网站 我已经创建了一个在单击时工作的引导模式,但是使用jQuery,是否可以在页面加载几秒钟后使其显示? 而一旦关闭就不会再出现 请参阅下面我的代码,以及 尝试这样做: if (typeof $.cookie('yourCookie') === 'undefined') //Create yourCookie and display your modal else //Go on your website 您的问题是“不使用jqu

我需要把一个弹出窗口到一个网站上,告诉用户有一个新版本的网站

我已经创建了一个在单击时工作的引导模式,但是使用jQuery,是否可以在页面加载几秒钟后使其显示? 而一旦关闭就不会再出现

请参阅下面我的代码,以及

尝试这样做:

if (typeof $.cookie('yourCookie') === 'undefined')
  //Create yourCookie and display your modal
else
  //Go on your website

您的问题是“不使用jquery”。。。?而且,正如现在一样,当我打开小提琴时,你的模态被加载了。不,我正在尝试使用jQuery使它工作。我不知道为什么它会在JSFIDLE上打开,在我的网站上,它会一直关闭,直到我点击按钮。听起来好像你想在加载页面时触发一些代码。。。因此,您需要查看jquery“ready”函数,这里有一些关于运行该函数的信息:感谢您提供的链接,这听起来正是我想要的。我尝试了$(document).ready(函数(){$('#exampleModalCenter')。单击();});但似乎不起作用
.modal-title{
    text-align: center;
}
.modal-content{
    background-color: #063242;
    height: 500px;
    width: 750px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
}
.modal-body{
    text-align: center;
    color: #fff;
    display: flex;
    justify-content: center;
}
.modal-body h2{
    width: 60%;
    border-left: 3px solid #E52149;
    border-right: 3px solid #ADD13D;
    font-weight: 400;
}
.modal-header{
    border-bottom: 0;
}
.modal-footer{
    border-top: 0;
    text-align: center;
}
.modal-header .close{
    color: #fff;
    position: absolute;
    top: 25px;
    right: 25px;
}
.visit-button{
    border: 3px solid #E52149;
    background-color: transparent;
    margin-right: 55px;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
}
.visit-button h3{
    margin: 0;
    color: #fff;
    font-weight: 400;
    padding: 3px;
}
.visit-button:hover{
    background-color: #E52149;
    color: #fff;
}
.close-button{
    border: 3px solid #ADD13D;
    background-color: transparent;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-radius: 0;
}
.close-button h3{
    margin: 0;
    color: #fff;
    font-weight: 400;
    padding: 3px;
}
.close-button:hover{
    background-color: #ADD13D;
    color: #fff;
}
if (typeof $.cookie('yourCookie') === 'undefined')
  //Create yourCookie and display your modal
else
  //Go on your website