gpt4 book ai didi

javascript - 关闭模式弹出窗口后,如何重定向到模式弹出窗口中的第一个选项卡?

转载 作者:行者123 更新时间:2023-12-03 05:37:52 24 4
gpt4 key购买 nike

    <!-- Large modal -->
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal">
Login modal</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h4 class="modal-title" id="myModalLabel">
Login/Registration - <a href="http://www.jquery2dotnet.com">jquery2dotnet.com</a></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8" style="border-right: 1px dotted #C2C2C2;padding-right: 30px;">
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#Login" data-toggle="tab">Login</a></li>
<li><a href="#Registration" data-toggle="tab">Registration</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="Login">
<form role="form" class="form-horizontal">
<div class="form-group">
<label for="email" class="col-sm-2 control-label">
Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email1" placeholder="Email" />
</div>
</div>
<div class="form-group">
<label for="exampleInputPassword1" class="col-sm-2 control-label">
Password</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="exampleInputPassword1" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<button type="submit" class="btn btn-primary btn-sm">
Submit</button>
<a href="javascript:;">Forgot your password?</a>
</div>
</div>
</form>
</div>
<div class="tab-pane" id="Registration">
<form role="form" class="form-horizontal">
<div class="form-group">
<label for="email" class="col-sm-2 control-label">
Name</label>
<div class="col-sm-10">
<div class="row">
<div class="col-md-3">
<select class="form-control">
<option>Mr.</option>
<option>Ms.</option>
<option>Mrs.</option>
</select>
</div>
<div class="col-md-9">
<input type="text" class="form-control" placeholder="Name" />
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-2 control-label">
Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Email" />
</div>
</div>
<div class="form-group">
<label for="mobile" class="col-sm-2 control-label">
Mobile</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="mobile" placeholder="Mobile" />
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">
Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" placeholder="Password" />
</div>
</div>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-10">
<button type="button" class="btn btn-primary btn-sm">
Save & Continue</button>
<button type="button" class="btn btn-default btn-sm">
Cancel</button>
</div>
</div>
</form>
</div>
</div>
<div id="OR" class="hidden-xs">
OR</div>
</div>
<div class="col-md-4">
<div class="row text-center sign-with">
<div class="col-md-12">
<h3>
Sign in with</h3>
</div>
<div class="col-md-12">
<div class="btn-group btn-group-justified">
<a href="#" class="btn btn-primary">Facebook</a> <a href="#" class="btn btn-danger">
Google</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

我的模式弹出窗口有两个选项卡,例如登录和注册,我单击注册选项卡,然后关闭模式弹出窗口,单击模式弹出窗口后,它位于注册选项卡中,但我想显示登录选项卡。怎么可能?

最佳答案

在 JavaScript 中更改以下代码,以便在单击“登录模式”按钮时始终显示登录选项卡

$(document).ready(function() {      

$('#myModal').on('shown.bs.modal', function() {
$('.nav-tabs a[href="#Login"]').tab('show');
});
});

如果更改 HTML 结构,上述代码将不起作用。它用于选项卡,您可以从 this 中删除选项卡功能。演示。但我仍然修复了你的 issue 。找到下面

$(document).ready(function() {    
$('#login-modal').on('shown.bs.modal', function() {
$('#login').addClass('active');
$('#forgetpassword').removeClass('active');
});
});

关于javascript - 关闭模式弹出窗口后,如何重定向到模式弹出窗口中的第一个选项卡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40655615/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com