Javascript setTimeout()函数,用于在10秒后显示弹出窗口
我想用这段代码在加载页面10秒后显示whatsapp发送消息,但我不知道如何合并它们Javascript setTimeout()函数,用于在10秒后显示弹出窗口,javascript,whatsapp,Javascript,Whatsapp,我想用这段代码在加载页面10秒后显示whatsapp发送消息,但我不知道如何合并它们 window.onload = function() { setTimeout(function() { document.getElementById('mydiv').style.display = 'block'; }, 10000); } $(函数(){ $('WAButton')。浮动WhatsApp({ 电话:'1231',//WhatsApp商务电话号码国际格式- //把它交给托
window.onload = function() {
setTimeout(function() {
document.getElementById('mydiv').style.display = 'block';
}, 10000);
}
$(函数(){
$('WAButton')。浮动WhatsApp({
电话:'1231',//WhatsApp商务电话号码国际格式-
//把它交给托基https://toky.co/en/features/whatsapp.
标题:“在WhatsApp上与我们聊天!”//弹出标题
popupMessage:'您好,我们能为您做些什么?',//弹出消息
showPopup:true,//启用弹出显示
按钮图像:“”,//按钮图像
//headerColor:'深红色',//自定义标题颜色
//backgroundColor:'深红色',//自定义背景按钮颜色
位置:“右”
});
});
只需创建一个函数并在超时时间内调用它
function show_whatsapp_button(){
$('#WAButton').floatingWhatsApp({
phone: '1231231231', //WhatsApp Business phone number International format-
//Get it with Toky at https://toky.co/en/features/whatsapp.
headerTitle: 'Chat with us on WhatsApp!', //Popup Title
popupMessage: 'Hello, how can we help you?', //Popup Message
showPopup: true, //Enables popup display
buttonImage: '<img src="https://rawcdn.githack.com/rafaelbotazini/floating-whatsapp/3d18b26d5c7d430a1ab0b664f8ca6b69014aed68/whatsapp.svg" />', //Button Image
//headerColor: 'crimson', //Custom header color
//backgroundColor: 'crimson', //Custom background button color
position: "right"
});
document.getElementById('mydiv').style.display = 'block';
}
window.onload = function() {
setTimeout(function() {
show_whatsapp_button();
}, 10000);
}
函数show_whatsapp_按钮(){
$('WAButton')。浮动WhatsApp({
电话:'1231',//WhatsApp商务电话号码国际格式-
//把它交给托基https://toky.co/en/features/whatsapp.
标题:“在WhatsApp上与我们聊天!”//弹出标题
popupMessage:'您好,我们能为您做些什么?',//弹出消息
showPopup:true,//启用弹出显示
按钮图像:“”,//按钮图像
//headerColor:'深红色',//自定义标题颜色
//backgroundColor:'深红色',//自定义背景按钮颜色
位置:“右”
});
document.getElementById('mydiv').style.display='block';
}
window.onload=函数(){
setTimeout(函数(){
显示whatsapp按钮();
}, 10000);
}
问题是什么?我想在使用此代码加载页面10秒后显示whatsapp发送消息,但我不知道如何将两者合并
function show_whatsapp_button(){
$('#WAButton').floatingWhatsApp({
phone: '1231231231', //WhatsApp Business phone number International format-
//Get it with Toky at https://toky.co/en/features/whatsapp.
headerTitle: 'Chat with us on WhatsApp!', //Popup Title
popupMessage: 'Hello, how can we help you?', //Popup Message
showPopup: true, //Enables popup display
buttonImage: '<img src="https://rawcdn.githack.com/rafaelbotazini/floating-whatsapp/3d18b26d5c7d430a1ab0b664f8ca6b69014aed68/whatsapp.svg" />', //Button Image
//headerColor: 'crimson', //Custom header color
//backgroundColor: 'crimson', //Custom background button color
position: "right"
});
document.getElementById('mydiv').style.display = 'block';
}
window.onload = function() {
setTimeout(function() {
show_whatsapp_button();
}, 10000);
}