我使用以下代码显示登录模式弹出窗口。它运作良好。但我需要另一个功能来显示模型弹出窗口而无需单击按钮。如果我调用该函数意味着应该出现相同的弹出窗口。请帮我这样做。
<a id="modal_trigger" tabindex="-1" href="#modal" class="btn">Login </a>
<script type="text/javascript">
$("#modal_trigger").leanModal({ top: 200, overlay: 0.6, closeButton: ".modal_close" });
$(function () {
// Calling Login Form
//$("#login_form").click(function () {
//$(".user_login").show();
//return false;
//});
})
</script>
<div id="modal" class="popupContainer" style="display: none;">
<header class="popupHeader">
<span class="header_title"><i class="fa fa-user"> Login</i></span>
<span class="modal_close"><i class="fa fa-times"></i></span>
</header>
<section class="popupBody">
<!-- Social Login -->
<div class="user_login">
<form>
<label>Username</label>
<input type="text" />
<br />
<label>Password</label>
<input type="password" />
<br />
<div class="checkbox">
<input id="remember" type="checkbox" />
<label for="remember">Remember me on this computer</label>
</div>
<div class="action_btns">
<div class="one_half"><a href="#" class="btn back_btn"><i class="fa fa-angle-double-left"></i> Back</a></div>
<div class="one_half last"><a href="#" id="login_form" class="btn btn_red">Login</a></div>
</div>
</form>
<a href="#" class="forgot_password">Forgot password?</a>
</div>
</section>
</div>
答案 0 :(得分:0)
试试这会显示弹出窗口
$('#login_form').trigger('click');