[英]Bootstrap Modal Contact Form Disappear
I have a problem with the Bootstrap Contact Form which disappear when the navigation bar is changed in terms of responsive design. 我的Bootstrap联系表单有问题,当根据响应式设计更改导航栏时,该表单消失了。 I can't find the word for it right now, but basically the navigation bar is replaced by a navigation icon for mobile and tablet when the screen width is below 991px.
我现在找不到合适的词,但是当屏幕宽度低于991px时,导航栏基本上被手机和平板电脑的导航图标所代替。 (see CSS)
(请参阅CSS)
A better overview: 更好的概述:
How it works: 这个怎么运作:
What works: 什么有效:
The contact form opens fine in both the nav bar and below the cover photo when the screen size is larger than 991px. 当屏幕尺寸大于991px时,在导航栏和封面照片下方均可正常打开联系表。
Below 991px: The contact form opens when I press the menu icon and then the list link. 991px以下:当我按菜单图标,然后按列表链接时,联系表将打开。
What does not work: 什么不起作用:
CSS CSS
/* Header */
.navbar-header {
width: 100%;
}
.navbar-header ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.navbar-header li {
display: inline;
}
.navbar-inverse {
background-color: white;
border-color: white;
}
#navbar-brand-cont {
padding-top: 5px;
}
.navbar-brand img {
height: 22px;
}
#header_menu ul {
list-style-type: none;
margin: 0;
padding-bottom: 10px;
margin-top: 17px;
}
#header_menu li {
display: inline;
margin-left: 30px;
margin-right: 30px;
}
#header_menu li a {
color: #000;
text-decoration: none;
}
#header_menu li a:hover {
color: #99cc66;
}
@media only screen and (min-width: 992px) and (max-width: 1200px) {
#header_menu li {
margin-left: 10px;
margin-right: 10px;
}
}
/*Hide dropdown links until they are needed*/
#header_menu li ul {
display: none;
}
/*Make dropdown links vertical*/
#header_menu li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
#header_menu li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
#header_menu ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
#header_menu .show-menu {
text-decoration: none;
color: #fff;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
#header_menu input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
#header_menu input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
@media screen and (max-width : 991px){
/*Make dropdown links appear inline*/
#header_menu ul {
position: static;
display: none;
padding-left: 0px;
}
/*Create vertical spacing*/
#header_menu li {
margin-bottom: 10px;
clear: both;
display: block;
margin-left: 0px;
margin-right: 0px;
}
/*Make all menu links full width*/
#header_menu ul li, li a {
width: 100%;
clear: both;
}
/*Display 'show menu' link*/
#header_menu .show-menu {
display:block;
}
.stortest {
font-size: 18px;
}
}
#myModal {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
}
.modal-open {
padding-right: 0!important;
}
.modal-content, .modal-dialog {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
text-align: left;
margin-top: 60px;
}
.modal {
position: fixed;
right: o;
top: 60px;
}
.modal-header {
background: black;
color: grey;
}
.modal-header .close {
color: #99cc66 !important;
text-shadow: 0px 0px;
}
.modal-header a:link {
color: #99cc66 !important;
}
.modal-body {
background: #99cc66;
text-align: left;
}
.btn {
background: none;
}
.popover {
background-color: #black;
color: #black;
width: 250px;
}
.popover.right .arrow:after {
border-right-color: #black;
}
.input-group[class*="col-"] {
padding-right: 15px;
padding-left: 15px;
}
.btn btn-custom pull-bottom {
background-color: #99cc66;
}
h4.modal-title {
color: #99cc66;
margin-bottom:20px;
}
li.popupp {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
}
/* Sosiale ikoner */
#icon-bar-holder {
float: right;
}
#icon-bar-holder ul {
padding-bottom: 0px;
margin-top: 0px;
}
#icon-bar-holder li {
list-style-type: none;
margin-left: 0;
margin-right: 0;
}
#iconbar-left, #iconbar-right {
width: 50px;
height: 50px;
}
#icon-bar-left, #icon-bar-left:hover, #icon-bar-right, #icon-bar-right:hover {
width: 30px;
height: 30px;
background-size: 30px auto;
display: inline-block;
}
#icon-bar-left {
background: url(img/ikoner/twitter_hover.png) no-repeat top left;
background-size: 30px auto;
}
#icon-bar-left:hover {
background: url(img/ikoner/twitter.png) no-repeat top left;
background-size: 30px auto;
}
#icon-bar-right {
background: url(img/ikoner/facebook_hover.png) no-repeat top left;
background-size: 30px auto;
}
#icon-bar-right:hover {
background: url(img/ikoner/facebook.png) no-repeat top left;
background-size: 30px auto;
}
@media screen and (max-width : 365px) {
#icon-bar img {
display: none;
}
}
@media screen and (max-width : 450px) {
.navbar-brand img {
height: 18px;
}
#icon-bar img {
margin-top: 0px;
width: 20px;
}
}
@media only screen and (min-width: 100px) and (max-width: 450px) {
.navbar-header {
margin: 0;
}
}
@media only screen and (min-width: 100px) and (max-width: 450px) {
.navbar-header{
margin-left: 0;
margin-right: 0;
}
#header_menu {
margin-top: 4px;
}
}
@media only screen and (min-width: 451px) and (max-width: 991px) {
#header_menu {
margin-top: 8px;
}
}
PHP - Navigation bar PHP-导航栏
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<div id="navbar-brand-cont">
<a class="navbar-brand" href="http://sookvisuals.com/dev/innbokskontroll">
<img src="<?php bloginfo('stylesheet_directory'); ?>/img/innbokskontroll.png">
</a>
</div>
<div id="header_menu">
<label for="show-menu" class="show-menu"><img src=<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/innbokskontroll_nav_menu.png height="15px"></label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li><a href="http://sookvisuals.com/dev/innbokskontroll/laer-innbokskontroll/" class="stortest btn btn-custom" >1</a></li>
<li><a href="http://sookvisuals.com/dev/innbokskontroll/referanser/" class="stortest btn btn-custom">2</a></li>
<li><a href="http://sookvisuals.com/dev/innbokskontroll/blogg" class="stortest btn btn-custom">3</a></li>
<li class="popupp">
<a href="#myModal" role="button" class="stortest btn btn-custom" data-toggle="modal">4</a>
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Bestill<br/>foredrag</h4>
<p>Text</p>
<p>Text</p>
</div>
<div class="modal-body">
<form class="form-horizontal" name="commentform" method="post" action="send_form_email.php">
<div class="form-group">
<div class="col-md-6 input-group">
<input type="email" class="form-control" id="email" name="email" placeholder="E-post"/>
</div>
</div>
<div class="form-group">
<div class="col-md-9">
<textarea rows="8" class="form-control" id="comments" name="comments" placeholder="melding"></textarea>
</div>
<div class="col-md-2">
<button type="submit" value="Submit" class="btn btn-custom pull-right" id="send_btn"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/pil_h_ny.png"></button>
</div>
</div>
</form>
</div><!-- End of Modal body -->
</div><!-- End of Modal content -->
</div><!-- End of Modal dialog -->
</div><!-- End of Modal -->
<?php
// here comes the form - removed because it does not have any affect on this question.
?>
<script>
$('#send_btn').popover({content: 'Takk for henvendelsen! Din melding blir sendt nå.'},'click');
</script>
</li>
<div id="icon-bar-holder">
<ul>
<li id="iconbar-left">
<a href="http://facebook.com/innbokskontroll" target="blank">
<span id="icon-bar-left">
</span>
</a>
<li id="iconbar-right">
<a href="http://twitter.com/jkippers" target="_blank">
<span id="icon-bar-right">
</span>
</a>
</li>
</ul>
</div>
</ul>
</div>
</div>
</nav>
PHP - Below the cover photo PHP-封面照片下方
<div id="bestill_lear_forside" class="row">
<a href="#myModal" role="button" class="btn btn-custom" data-toggle="modal">
<div id="bestill_forside" class="col-sm-6 svart">
<div class="pull-right vertical-center half-content-wrapper" style="width: 100%;margin-right: 80px">
<img class="pull-left" src="<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/pil_v.png">
<span class="pull-right bestill_forside_venstre">Bestill foredrag!</span>
</div>
</div>
</a>
<a href="http://sookvisuals.com/dev/innbokskontroll/laer-innbokskontroll/" target="_self">
<div id="lear_forside" class="col-sm-6 hvit">
<div class="pull-left vertical-center half-content-wrapper" style="width: 100%;margin-left: 80px">
<img class="pull-right" src="<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/pil_h_ny.png">
<span class="bestill_forside_hoyre">Lær innbokskontroll!</span>
</div>
</div>
</a>
</div>
Any ideas? 有任何想法吗? Ask if there are any confusions.
询问是否有任何混淆。 I was going to post screenshots, but Photoshop stopped working...
我本来要发布屏幕截图,但是Photoshop停止了工作...
Just for clarification - are both divs .modal and .modal-dialog not showing on <991px? 只是为了澄清-divs .modal和.modal-dialog都没有显示在<991px上吗? I'm seeing a few issues here -
我在这里看到一些问题-
Modals should not be nested within list items; 模态不应嵌套在列表项中; try removing this code
尝试删除此代码
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Bestill<br/>foredrag</h4>
<p>Text</p>
<p>Text</p>
</div>
<div class="modal-body">
<form class="form-horizontal" name="commentform" method="post" action="send_form_email.php">
<div class="form-group">
<div class="col-md-6 input-group">
<input type="email" class="form-control" id="email" name="email" placeholder="E-post"/>
</div>
</div>
<div class="form-group">
<div class="col-md-9">
<textarea rows="8" class="form-control" id="comments" name="comments" placeholder="melding"></textarea>
</div>
<div class="col-md-2">
<button type="submit" value="Submit" class="btn btn-custom pull-right" id="send_btn"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/pil_h_ny.png"></button>
</div>
</div>
</form>
</div><!-- End of Modal body -->
</div><!-- End of Modal content -->
</div><!-- End of Modal dialog -->
</div><!-- End of Modal -->
Also try adding sm and xs column classes (ie col-sm-9, col-xs-9) to your modal for more control on the mobile version. 也可以尝试将sm和xs列类(即col-sm-9,col-xs-9)添加到您的模式中,以更好地控制移动版本。 And finally, in
最后,在
.modal {
position: fixed;
right: o;
top: 60px;
}
right:o; 右:O; should be right:0.
应该是正确的:0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.