modal getting stuck inside parent div on mobile devices - php

I am having some trouble with a modal that seems to get stuck inside its parent div on mobile devices only, I have replicated this code onto a blank html to make sure nothing was conflicting with it and then accessed it on mobile but still the modal appears inside the "slider" div, but on PC it shows up fine, not inside the slider div.
The issue is that I cant move the modal code outside of the slider div since it needs to remain within the foreach statement (Please refer to my JSFiddle)
Some background: the <div class="slider"> contains a foreach statement and for each item that has been previously purchased in the users account will appear as a <div class="slide"></div> which has a button for a popup modal that has the id set as the order ID from the database for that particular item (hence why I cant move the modal outside of the slider div)
This is the slider on mobile
This is when the modal is open (Inside the slider div)
JSFiddle
<!-- slider div --->
<div class="slider">
<!-- FOREACH EXAMPLE
$squirtle = $dbh->prepare("SELECT * FROM `orders` WHERE `userID` = '$userID' ORDER BY `date` DESC");
$squirtle->execute();
$onyx = $squirtle->fetchAll();
if (count($onyx) == '0'){
echo ('<p style="margin-left:24px;"><small>No purchases..</small></p>');
} else {
foreach ($onyx as $ditto) {
--->
<!-- EACH SLIDE --->
<div class="slide" id="slide" style="margin-left:24px;">
<img src="/images/products/<?php echo $ditto['prodimage']; ?>" style="width:80px;">
<!-- Modal Button -->
<i style="vertical-align:top;color:#888;" data-toggle="modal" data-target="#exampleModal" class="fas fa-ellipsis-v"></i>
</div>
<!-- --- --->
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content" style="margin-top:64px;">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Order options</h5>
</div>
<div class="modal-body" style="height:140px;">
<img src="/images/products/<?php echo $ditto['prodimage']; ?>" style="width:82px;margin-top:0;margin-right:24px;float:right;">
View Progress
</div>
<div class="modal-footer">
<button style="background-color:#0d6efd;" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!--
}}
-->
</div>
and my CSS..
.slider {
width: 100%;
padding: 6px 0px;
display: flex;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scroll-snap-type: x mandatory;
-ms-overflow-style: none;
/* IE and Edge */
scrollbar-width: none;
/* Firefox */
}
.slider::-webkit-scrollbar {
display: none;
}
.slide {
width: 140px;
flex-shrink: 0;
height: 100%;
}
.slider, .slide {
scroll-snap-align:start;
}
.slider img {
margin: 6px 6px;
}
#media(max-width:768px){
.modal{
z-index:99999 !important;
position:absolute !important;
top:0 !important;
}
}
.modal {
position: fixed !important;
bottom: 0 !important;
left: 0 !important;
z-index: 99999 !important;
display: none;
width: 100%;
height: 100%;
overflow-x: hidden !important;
overflow-y: auto !important;
outline: 0;
background-color: rgba(10, 10, 10, 0.45);
}
.modal-backdrop {
display: none !important;
}
.modal-content {
color: black !important;
z-index: 99999 !important;
position: relative;
display: block;
flex-direction: column;
width: 100%;
pointer-events: auto;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .2);
border-radius: .3rem;
outline: 0;
}
i.fa-ellipsis-v {
border-radius: 60px;
box-shadow: 0 0 2px #888;
padding: 0.5em 0.6em;
font-size: 14px;
}
i.fa-ellipsis-v:hover {
cursor: pointer;
}

Related

Three dots menu PHP HTML

I am creating a social site and I want to leave three menu dots on the top right corner of each individual post a user makes. But it only works on one post. They show up on all of the posts but when I click it, the dropdown content only shows on the very first post at the top of the page.
I put it in my posts loop so I don't see why it's not working.
$str .= "<div class='status_post'>
<div class='post_profile_pic'>
<img src='$profile_pic' width='50'>
</div>
<!-- three dot menu -->
<div class='dropdownPosts'>
<!-- three dots -->
<ul class='dropdownbtn icons btn-right showLeft' onclick='showDropdown()'>
<li></li>
<li></li>
<li></li>
</ul>
<!-- menu -->
<div id='myDropdown' class='dropdownPost-content'>
<a href='#home'>Home</a>
<a href='#about'>About</a>
<a href='#contact'>Contact</a>
</div>
</div>
<div class='posted_by' style='color:#ACACAC;'>
<a href='$added_by'> $username </a> $user_to $time_message
$delete_button
</div>
<div id='post_body'>
$body
<br>
$imageDiv
<br>
<br>
</div>
<div class='newsfeedPostOptions' onClick='javascript:toggle$id(event)'>
Comments($comments_check_num)
<iframe src='like.php?post_id=$id' scrolling='no'></iframe>
</div>
</div>
<div class='post_comment' id='toggleComment$id' style='display:none;'>
<iframe src='comment_frame.php?post_id=$id' id='comment_iframe' frameborder='0'></iframe>
</div>
<hr>";
.header{
width: 100%;
background-color: #0d77b6 !important;
height: 60px;
}
.showLeft{
color:#000 !important;
padding:10px;
}
.icons li {
background: none repeat scroll 0 0 #000;
height: 7px;
width: 7px;
line-height: 0;
list-style: none outside none;
margin-right: 15px;
margin-top: 3px;
vertical-align: top;
border-radius:50%;
pointer-events: none;
}
.btn-left {
left: 0.4em;
}
.btn-right {
right: 0.4em;
}
.btn-left, .btn-right {
position: absolute;
top: 0.24em;
}
.dropdownbtn {
position: absolute;
color: white;
font-size: 16px;
border: none;
cursor: pointer;
margin-top: 6%;
margin-right: 30%;
}
.dropdownPosts {
position: absolute;
display: inline-block;
right: 0.4em;
}
.dropdownPost-content {
display: none;
position: absolute;
margin-top: 60px;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdownPost-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdownPosts a:hover {background-color: #f1f1f1}
.show {display:block;}
<script>
function changeLanguage(language) {
var element = document.getElementById("url");
element.value = language;
element.innerHTML = language;
}
function showDropdown() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropdownbtn')) {
var dropdowns = document.getElementsByClassName("dropdownPost-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
If you remove any duplicated IDs from the HTML and modify the 3-dots portion like so
<div class='dropdownPosts'>
<!-- three dots -->
<ul class='dropdownbtn icons btn-right showLeft' onclick='showDropdown(event)'>
<li></li>
<li></li>
<li></li>
</ul>
<!-- menu -->
<div class='dropdownPost-content'>
<a href='#home'>Home</a>
<a href='#about'>About</a>
<a href='#contact'>Contact</a>
</div>
</div>
You can then likey modify your showDropdown function like this:
function showDropdown(event) {
event.target.nextElementSibling.classList.toggle("show");
}

show description when clicked

i will need some help with some coding if possible. I would like to have when clicked Learn More to show description above the button and when clicked back to hide it. Any help would be higly appreciated! Code listed below. Thank you for your time!
One more thing, as you can see the top border is not shown, how can i make it to show? Thank you very much for the time spent!
<style>
/* RELATE PRODUCTS BEGIN */
.cardd {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 600px;
margin: auto;
text-align: center;
font-family: arial;
}
.cardd p {
font-family: "Arial Black", Gadget, sans-serif;
font-size: 24px;
font-weight: bold;
margin-top: 6px;
margin-bottom: 5px;
margin-left: 0px;
text-align: left;
padding-top: 6px;
}
.price {
color: grey;
font-size: 22px;
}
.cardd button {
border: none;
outline: 0;
padding: 12px;
color: white;
background-color: #c41735;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
.cardd button:hover {
opacity: 0.7;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
padding: 0;
margin-top: 0px;
margin-bottom: 10px;
}
</style>
<div class="container">
<!-- <div class="row no-margin">
<div class="col-lg-12 text-center">
<h1 class="section-heading">Harnesses</h1>
</div>
</div> -->
<div class="row">
<div class="col-lg-12 scrollReveal sr-bottom sr-ease-in-out-quad sr-delay-1">
<br><br><br>
<h1 class="section-heading page-heading">Engines</h1>
<p></p>
</div>
</div>
<div class="height-60"> </div>
<div class="row">
<div class="col-lg-3 col-md-6 mb-5 col-sm-12">
<div class="scrollReveal sr-bottom sr-ease-in-out-quad sr-delay-1 ">
<div class="cardd">
<img src="g" alt="" style="width:100%">
<h2 class="page-heading">Vittorazi<br> Moster185 Plus MY20</h1>
<span class="price">£1729.99</span>
<p></p>
<p><button>Learn more</button></p>
<p></p>
</div>
</div>
</div> <br>
<div class="col-lg-3 col-md-6 mb-5 col-sm-12">
<div class="scrollReveal sr-bottom sr-ease-in-out-quad sr-delay-1">
<div class="cardd">
<img src="g" alt="" style="width:100%">
<h2 class="page-heading"><br> </h1>
<span class="price">£1729.99</span>
<p></p>
<p><button>Learn more</button></p>
</div>
</div>
</div> <br>
<div class="col-lg-3 col-md-6 mb-5 col-sm-12">
<div class="scrollReveal sr-bottom sr-ease-in-out-quad sr-delay-1">
<div class="cardd">
<img src="" alt="" style="width:100%">
<h2 class="page-heading"><br> </h1>
<span class="price">£1729.99</span>
<p></p>
<p><button>Learn more</button></p>
</div>
</div>
</div> <br>
<div class="col-lg-3 col-md-6 mb-5 col-sm-12">
<div class="scrollReveal sr-bottom sr-ease-in-out-quad sr-delay-1">
<div class="cardd">
<img src="" alt="Atom 80 Vitorazzi" style="width:100%">
<h2 class="page-heading"><br></h1>
<span class="price">£1729.99</span>
<p></p>
<p><button>Learn more</button></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
What you're looking for is a collapsible! All you need is a little JavaScript, and you can expand/collapse text using a button.
Expand Above
If you want to make the hidden text appear above the button, try this:
var collapse = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < collapse.length; i++) {
collapse[i].addEventListener("click", function() {
this.classList.toggle("active");
var expand = this.previousElementSibling;
if (expand.style.display === "block") {
expand.style.display = "none";
} else {
expand.style.display = "block";
}
});
}
.collapsible {
border: none;
outline: 0;
padding: 12px;
color: white;
background-color: #c41735;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
.expand {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #eee;
}
<div class="expand">
<p>
Hidden text.
</p>
</div>
<button type="button" class="collapsible">Learn more</button>
Expand Below
If you want to make it appear below the button, however, just flip the order in which the <div> and <button> element appear, and switch out previousElementSibling with nextElementSibling:
var collapse = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < collapse.length; i++) {
collapse[i].addEventListener("click", function() {
this.classList.toggle("active");
var expand = this.nextElementSibling;
if (expand.style.display === "block") {
expand.style.display = "none";
} else {
expand.style.display = "block";
}
});
}
.collapsible {
border: none;
outline: 0;
padding: 12px;
color: white;
background-color: #c41735;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
.expand {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #eee;
}
<button type="button" class="collapsible">Learn more</button>
<div class="expand">
<p>
Hidden text.
</p>
</div>
To make the text hide and appear above the Button you must make use of toggle() event as
$("document").ready(function(){
$(".collapsible").toggle(
function(){
$(".expand").css({"display" : "block"});},
function(){
$(".expand").css({"display" : "none"});});
});
.collapsible {
border: none;
outline: 0;
padding: 12px;
color: white;
background-color: #c41735;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
.expand {
padding: 0 18px;
display: none;
overflow: hidden;
background-color: #eee;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<div class="expand">
<p>
Hidden text.
</p>
</div>
<button type="button" class="collapsible">Learn more</button>
Note: Add the Jquery CDN to use the jquery code.
(<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js">
</script>)

How to fix position of CSS elements?

I would like to create a website with a tile layout, similar to the new Windows style. https://dab1nmslvvntp.cloudfront.net/wp-content/uploads/jquery4u/2013/03/metro-template.png <- kind of like this, except that in my case:
each tile is the same size (square) (.box)
The text should be in the centered in the tile (.center-box-content)
each tile should entail two buttons in its lower right corner, in addition to the text (.lower-right-box-content)
The buttons are edit and trash icons, so that the text in the tiles can be changed.
I have accomplished this, but the problem is: The buttons seem to be dependent on the text length.
I've assigned them an absolute position in the css file, yet they don't stay put.
If the text in the tile is longer, they move all the way past/beyond the tile's borders, which they shouldn't surpass. It's a complete mess. I have tried everything but I can not find a solution. I am hoping that you guys can take a look and maybe see what I am missing? Here's my CSS Code:
.box {
width: 200px;
height: 200px;
margin: 2px;
color: whitesmoke;
float: left;
padding: 7px;
}
.center-box-content {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.lower-right-box-content {
position: absolute;
float: right;
padding: 2px;
bottom: -60px;
right: -5px;
}
.red-box {
background-color: indianred;
}
.blue-box {
background-color: deepskyblue;
}
.green-box {
background-color: mediumseagreen;
}
Here is my HTML Code: (The PHP bit just reads out the text from the data base, which is an event name, event description, and event date)
<!--the entire square tile -->
<div class="box red-box" height="100%" width="100%">
<!--this centers the text within the tile -->
<div class="center-box-content">
<!--echo the name -->
<b><?php echo $row["title"]; ?></b>
<!--echo the description -->
<?php echo $row["description"]; ?>
<br> • <!--echo the date -->
<?php echo $row["date"]; ?> •
<!--edit and delete button in the lower right corner of the tile -->
<!--this is the part that keeps moving as the text gets longer -->
<div class="lower-right-box-content">
Upcoming Events <span style="display:inline-block; width: 20px;"></span>
<a href="#">
<span class="glyphicon glyphicon-pencil glyphicon-pencil" role="button"> </span>
</a>
<a href="deleteevent.php?id=<?php echo $row["eventid"];?>">
<span class="glyphicon glyphicon-trash glyphicon-trash" role="button"></span>
</span>
</a>
</div>
</div>
</div>
<?php };
?>
For ideal management of "box" today we use the grid. One example css for 6-columns grid:
body {
font-family: 'Ariel', sans-serif;
font-weight: 100;
font-size: 1em;
color: #faf3bc;
background-color: #0976B2;
}
.grid_1 { width: 15.625%; } /* 125px/800px = 15.625% */
.grid_2 { width: 32.5%; } /* 260px/800px = 32.5% */
.grid_3 { width: 49.375%; } /* 395px/800px = 49.375% */
.grid_4 { width: 65.625%; } /* 525px/800px = 65.625% */
.grid_5 { width: 83.125%; } /* 665px/800px = 83.125% */
.grid_6 { width: 100%; } /* 800px/800px = 100% */
.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6 {
/* margin-right: 1.25%; */
float: left;
display: block;
}
.last {margin-right:0; }
.container{
clear:both;
width: 90%;
max-width: 800px;
padding: 0% 0;
margin: auto;
}
img {
max-width: 100%;
}
h1 {
color: #ffffff;
}
a:link {color:#b4c34f; text-decoration:none;} /* unvisited link */
a:visited {color:#b4c34f; text-decoration:none;} /* visited link */
a:hover {color:#faf3bc; text-decoration:underline;} /* mouse over link */
a:active {color:#b4c34f; text-decoration:none;} /* selected link */
a.selected {color:#ffffff;} /* selected link */
ul {
list-style-type:none;
}
.form-input {
height: 30px;
}
#media screen and (max-width : 705px) {
.grid_1,
.grid_2,
.grid_3,
.grid_4,
.grid_5,
.grid_6 {
width: 100%;
}}
HTML for 3 "box" in raw:
<div class='grid_2'>
</div>
<div class='grid_2'>
</div>
<div class='grid_2 last'>
</div>
HTML for 2 "box" in raw:
<div class='grid_3'>
</div>
<div class='grid_3 last'>
</div>
Maybe you need more grid-columns, go ahead, learn responsive web design.
Is the square the direct parent of those absolutely positioned elements? It should be, and it needs to have position: relative for the absolute position to work.
And erase the float from those elements - it doesn't make sense for absolutely positioned elements.
Here is the jsfiddle link
You need to set the .lower-right-box-content to position:relative and then make the buttons absolute positioned.
<div class="lower-right-box-content">
<div style="display:inline-block;margin-right:40px;text-align:justify;"> Upcoming Events longggg text does not matter </div>
<a href="#">
<span class="glyphicon glyphicon-pencil glyphicon-pencil" role="button" style='position:absolute;bottom:10px;right:5px;'> </span>
</a>
<a href="deleteevent.php?id=<?php echo $row["eventid"];?>">
<span class="glyphicon glyphicon-trash glyphicon-trash" role="button" style="position:absolute;bottom:10px;right:20px;">
</span>
</a
</div>
</div>
I have used inline styles for clarity. Please update the styles in stylesheet with appropriate selectors.
Place the buttons in their own div.
Add position: relative to the box.
Use position: absolute to place the text and buttons to the bottom.
To ensure longer text does not overlap with the buttons, add some padding to the text.
.box {
width: 200px;
height: 200px;
margin: 2px;
color: whitesmoke;
float: left;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: relative;
}
.center-box-content {
text-align: center;
}
.upcoming {
position: absolute;
bottom: 0;
text-align: center;
left: 0;
right: 0;
padding: 0 30px; /* ensure the text clears the buttons */
}
.buttons {
position: absolute;
bottom: 0;
right: 0;
}
.red-box {
background-color: indianred;
}
.blue-box {
background-color: deepskyblue;
}
.green-box {
background-color: mediumseagreen;
}
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box red-box">
<div class="center-box-content">
<b>Name</b>
<br>Description
<br> • Date •
</div>
<div class="lower-right-box-content">
<span class="upcoming">Upcoming events</span>
<div class="buttons">
<a href="#">
<span class="glyphicon glyphicon-pencil glyphicon-pencil" role="button"></span>
</a>
<a href="#">
<span class="glyphicon glyphicon-trash glyphicon-trash" role="button"></span>
</a>
</div>
</div>
</div>
<div class="box red-box">
<div class="center-box-content">
<b>Name</b>
<br>Description
<br> • Date •
</div>
<div class="lower-right-box-content">
<span class="upcoming">Upcoming events events events</span>
<div class="buttons">
<a href="#">
<span class="glyphicon glyphicon-pencil glyphicon-pencil" role="button"></span>
</a>
<a href="#">
<span class="glyphicon glyphicon-trash glyphicon-trash" role="button"></span>
</a>
</div>
</div>
</div>

how to append a div through JQuery like the eCommerce website on click or focus

This is my HTML code
<div>
<div class="text-center col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-md-3 col-sm-3 animate-box">
<div class="team-section-grid" style="background-image: url(assets/img/image-bg.jpg);">
<div class="overlay-section">
<div class="desc">
<i class="icon icon-wallet2"></i> Buy Now
</div>
</div>
</div>
<div class="text-center add-cart">
<a href="" title="">
<i class="icon icon-cart"></i> Add To Cart
</a>
<a href="" title="">
<i class="icon icon-heart" style="margin-left: 10px;"></i> Add To Wishlist
</a>
</div>
</div>
View More..
</div>
What i am trying to achieve through JQUery is whenever click the view more.. or whenever the focus is on that button I want the following div appended to the current div so that I can dynamically load products from the DB and append it.
Can anyone help me with that code? Thanks in advance..
Did you tried: http://api.jquery.com/append/ ?
A very simple example:
jQuery('.wrapper a').on('click', function(e){
e.preventDefault;
jQuery('.wrapper').append('<div class="item"></div>');
});
.wrapper{
position: relative;
background: #e6e6e6;
padding: 10px 10px 50px 10px;
}
.wrapper a{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 10px 0;
background: #aaa;
color: white;
text-align: center;
border-top: 3px solid #fff;
}
.item{
display: block;
width: 100%;
height: 20px;
background: #ccc;
margin: 0 0 5px 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="wrapper">
show more
<div class="item"></div>
</div>
Instead of append('<div class="item"></div>') you can append html-templates, too. It could be more comfortable to use a template engine here ...

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. 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. (see CSS)
A better overview:
How it works:
The contact form can be opened by pressing "4" in the navigation bar. (The word is replaced with 4 in the PHP because this is in Norwegian. )
The contact form can also be opened by pressing "bestill foredrag!"
below the cover photo.
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.
Below 991px: The contact form opens when I press the menu icon and then the list link.
What does not work:
Below 991px: The contact form is not being opened when I press "bestill foredrag!" below the cover photo.
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
<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>2</li>
<li>3</li>
<li class="popupp">
4
<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
<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...
Just for clarification - are both divs .modal and .modal-dialog not showing on <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 -->
from the navigation bar list item and moving it to the main container, so it isn't hidden by the collapse of the menu on mobile sizes.
Also try adding sm and xs column classes (i.e. col-sm-9, col-xs-9) to your modal for more control on the mobile version. And finally, in
.modal {
position: fixed;
right: o;
top: 60px;
}
right:o; should be right:0.

Categories