当我第二次点击我网站上的任何位置时,如何显示弹出窗口。 [英] How do I show a pop up window when I click any where in my website for the second time.

查看:57
本文介绍了当我第二次点击我网站上的任何位置时,如何显示弹出窗口。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用PHP创建一个网站。我希望任何访问我网站的人都可以访问任何页面,只需点击一下即可免费点击一下,如果用户没有登录,只要用户点击任何地方就会显示模式框。



如何实现???

解决方案

您可以获取HTML5 本地存储的帮助会话存储根据您的要求。您还可以存储在cookie中。



在这些存储选项中存储一个计数,当用户再次点击时,检查计数值并显示弹出窗口。


一个简单的jquery解决方案是:



  var  counter =  0 ; 


document )。on( ' 点击 function (){

counter ++;
if (counter == 2
// 此处显示模态代码
});


I am making a website in PHP. I want that any one who go to my website can visit any page and can do 1 free click any where but after one click if the user is NOT SIGN IN it will show a modal box any time the user clicks anywhere.

How do I implement that???

解决方案

You can take help of HTML5 Local Storage or Session Storage according to your requirements. You can also store in cookies.

Store one count in these storage options and when user clicks again check the count value and show the popup.


A simple jquery solution would be:

var counter = 0;


(document).on('click',function(){ counter++; if(counter == 2) //show modal code here });


这篇关于当我第二次点击我网站上的任何位置时,如何显示弹出窗口。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆