Reputation: 254
I'm using a Zend partialLoop to return an html script that will contain 1 or more div elements with data inside for a notifications popup. I'm having trouble getting the partialLoop div elements to stack on top of each other as one would expect under my current design.
How can I alter this to allow the div elements (notification-popup-container
and all of its child elements) to stack one after the other?
JSFiddle here: http://jsfiddle.net/phamousphil/rgt03mu4/
.notification-popup-container {
background-color: #fff;
border: 1px solid rgba(100, 100, 100, .4);
-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
overflow: visible;
position: absolute;
top: 55px;
left: 30px;
width: 400px;
z-index: 99;
display: none;
}
/*Popup Arrow*/
.notification-popup-container:before {
content: '';
display: block;
position: absolute;
width: 0;
height: 0;
color: transparent;
border: 10px solid black;
border-color: transparent transparent white;
margin-top: -20px;
/* margin-left: 337px; */
}
.notification-popup-body {
padding: 10px 0px 0px 0px !important;
}
$(function() {
var nContainer = $(".notification-popup-container");
//notification popup
$("#notification-link").click(function() {
nContainer.fadeToggle(300);
return false;
});
//page click to hide the popup
$(document).click(function() {
nContainer.hide();
});
//popup notification bubble on click
nContainer.click(function() {
return false;
});
});
<a id='notification-link' href='#'>
<img src='http://docs.blackberry.com/en/smartphone_users/deliverables/50635/mwa1358788933767_lowres_en-us.png' alt='Notifications' />
</a>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 1</div>
<div class="notification-popup-message">MESSAGE 1</div>
</div>
</div>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 2</div>
<div class="notification-popup-message">MESSAGE 2</div>
</div>
</div>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 3</div>
<div class="notification-popup-message">MESSAGE 3</div>
</div>
</div>
Upvotes: 0
Views: 138
Reputation: 3765
You need to place those containers into a single container and remove the absolute positioning on the inner container. You can move the absolute positioning to the outer container. Here I named it notification-popup-container-main
.
Here is an example: http://jsfiddle.net/rgt03mu4/3/
<a id='notification-link' href='#'>
<img src='http://docs.blackberry.com/en/smartphone_users/deliverables/50635/mwa1358788933767_lowres_en-us.png' alt='Notifications' />
</a>
<div class='notification-popup-container-main'>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 1</div>
<div class="notification-popup-message">MESSAGE 1</div>
</div>
</div>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 2</div>
<div class="notification-popup-message">MESSAGE 2</div>
</div>
</div>
<div class='notification-popup-container'>
<div class='notification-popup-body'>
<div class="notification-popup-title">TITLE 3</div>
<div class="notification-popup-message">MESSAGE 3</div>
</div>
</div>
</div>
CSS:
.notification-popup-container-main {
position: absolute;
top: 55px;
left: 30px;
}
.notification-popup-container {
background-color: #fff;
border: 1px solid rgba(100, 100, 100, .4);
-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
overflow: visible;
width: 400px;
z-index: 99;
display: none;
}
/*Popup Arrow*/
.notification-popup-container-main:before {
content: '';
display: block;
position: absolute;
width: 0;
height: 0;
color: transparent;
border: 10px solid black;
border-color: transparent transparent white;
margin-top: -20px;
/* margin-left: 337px; */
}
.notification-popup-body {
padding: 10px 0px 0px 0px !important;
}
Upvotes: 1