TapeGun007 Posted August 13, 2015 Share Posted August 13, 2015 Here is my CSS file: .overlay { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.7); transition: opacity 500ms; visibility: hidden; opacity: 0; } .overlay:target { visibility: visible; opacity: 1; } .popup { margin: 70px auto; padding: 20px; background: #fff; border-radius: 5px; width: 30%; position: relative; transition: all 5s ease-in-out; } .popup h2 { margin-top: 0; color: #333; font-family: Tahoma, Arial, sans-serif; } .popup .close { position: absolute; top: 20px; right: 30px; transition: all 200ms; font-size: 30px; font-weight: bold; text-decoration: none; color: #333; } .popup .close:hover { color: orange; } .popup .content { max-height: 30%; overflow: auto; } And here is my HTML <a href="#popup1">Let me Pop up</a> <div id="popup1" class="overlay"> <div class="popup[]"> <h2>Address:</h2> <a class="close" href="#">×</a> <div class="content"> Thanks for pop me out of that button, but now i'm done so you can close this window. </div> </div> </div> Quote Link to comment https://forums.phpfreaks.com/topic/297763-use-a-css-popup-multiple-times/ Share on other sites More sharing options...
TapeGun007 Posted August 13, 2015 Author Share Posted August 13, 2015 All of the code above works fine. It's a single pop up window. What if I wanted to use a pop up window for tabular data instead? So say I pull up 10 contacts, and you click a link next to the contact for "John Doe" and his address pops up, but then I click below on to "Jane Doe" and the pop up shows her address instead? How can I accomplish this? Quote Link to comment https://forums.phpfreaks.com/topic/297763-use-a-css-popup-multiple-times/#findComment-1518666 Share on other sites More sharing options...
Solution TapeGun007 Posted August 13, 2015 Author Solution Share Posted August 13, 2015 I woke up today, looked at the code and realized what I was missing from previous experiments! This works: <?php for ($x = 0; $x <= 10; $x++) { ?> <a href="#popup<?=$x; ?>">Let me Pop up</a> <div id="popup<?=$x; ?>" class="overlay"> <div class="popup"> <h2>Address:</h2> <a class="close" href="#">×</a> <div class="content"> <?=$x; ?> for pop me out of that button, but now i'm done so you can close this window. </div> </div> </div> <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/297763-use-a-css-popup-multiple-times/#findComment-1518712 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.