Imitation is the effect of petal login, his default HTML is this
登录
Click Login, will be in the #page with a login box,
登录花瓣
使用合作网站帐号登录
新浪微博豆瓣人人网QQ 未注册过花瓣也可以直接登录哦
使用注册邮箱登录
When you click Close, the login box is deleted. And when it comes out, it pulls down, and when it's closed, it's up, and I put the code in the/include/pop-login.php.
onclick="app.showSheet('login', {modal: true});return false;"
How he wrote that way.
$('.login').on('click',function(){ $.ajax({ async: false, url: "/include/pop-login.php", cache: false, success: function(html){ $("#page").append(html); } });});$('#sheet_login .close').live('click',function(){ $('.sheet-overlay').remove(); $('#sheet').remove();});
Reply content:
Imitation is the effect of petal login, his default HTML is this
登录
Click Login, will be in the #page with a login box,
登录花瓣
使用合作网站帐号登录
新浪微博豆瓣人人网QQ 未注册过花瓣也可以直接登录哦
使用注册邮箱登录
When you click Close, the login box is deleted. And when it comes out, it pulls down, and when it's closed, it's up, and I put the code in the/include/pop-login.php.
onclick="app.showSheet('login', {modal: true});return false;"
How he wrote that way.
$('.login').on('click',function(){ $.ajax({ async: false, url: "/include/pop-login.php", cache: false, success: function(html){ $("#page").append(html); } });});$('#sheet_login .close').live('click',function(){ $('.sheet-overlay').remove(); $('#sheet').remove();});
What about the feeling?
function on_click_login(){ $.ajax({ async: false, url: "/include/pop-login.php", cache: false, success: function(html){ $("#page").append(html); }, error: function(){ $('.login').one('click',on_click_login); } });}$('.login').one('click',on_click_login);$('#page').on('click','#sheet_login .close',function(){ $('.sheet-overlay').remove(); $('#sheet').remove(); $('.login').one('click',on_click_login);});
PS, because do not like live so readily changed ...
Also encountered the landlord of such a problem, at that time there is no good way to solve. It was a very ugly way to get rid of the problem.
At that time, wrote a hidden variable on the page, each time before the Ajax trigger, all clear, after the Ajax execution succeeds, delay 100ms, only to give him a value, and then each time the key to determine whether the hidden variable has a value.
var popLogin = { isLock: false, init: function() { if (popLogin.isLock) { //TODO... return false; } $.ajax({ url: "/include/pop-login.php", cache: false, success: function(html){ $("#page").append(html); }, complete: function() { popLogin.isLock = false; } }); }};$('.login').on('click', popLogin.init());
Wouldn't it be disable to drop the button at the click and then enable it at the end of Ajax ...