CodePen
codepen.io › Asadabbas › pen › pLMNGZ
Simple Popup [HTML + CSS + JS]
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
Videos
16:52
How To Make A Popup | HTML, CSS & JavaScript - YouTube
01:08
Build a Popup with JavaScript | 1-Minute Tutorial - YouTube
How To Make A Popup Using HTML, CSS And JavaScript ...
07:06
JavaScript Basics - how to make popup window with onclick method ...
16:55
Build a Popup With JavaScript - YouTube
11:54
JavaScript popup window - YouTube
CodePen
codepen.io › Shaz3e › pen › jEZpJW
Responsive Popup with JavaScript
<h1 class="s3-center">Responsive Popup with Javascript</h1> <p class="s3-center">Read the complete article tutorial <a href="http://blog.shaz3e.com/responsive-popup-with-javascript/">here</a>.</p> <!-- Overlay --> <div class="overlay" id="overlay" style="display:none;"></div> <!-- Popup --> <div class="popup" id="popup" style="display:none;"> <div class="popup-inner"> <input type="button" name="Close" class="s3-btn-close" onclick="popupClose();" value="×"> <h2>This is popup</h2> <p>Hey I am a popup overlay working with JavaScript</p> </div> </div> <!-- Popup Button --> <input type="button" class="s3-btn" name="Open" onclick="popupOpen();" value="Click to Show Overlay">
CodePen
codepen.io › asiburcodedrop › pen › PozrEby
Custom Popup Using Vanilla JavaScript
const clickBtn = document.getElementById("clickBtn"); const popup = document.getElementById("popup"); const closeBtn = document.getElementById("closeBtn"); clickBtn.addEventListener('click', ()=>{ popup.style.display = 'block'; }); closeBtn.addEventListener('click', ()=>{ popup.style.display = 'none'; }); popup.addEventListener('click', ()=>{ popup.style.display = 'none'; });
CodePen
codepen.io › tag › simple popup
Pens tagged 'simple popup' on CodePen
CodePen doesn't work very well without JavaScript · We're all for progressive enhancement, but CodePen is a bit unique in that it's all about writing and showing front end code, including JavaScript. It's required to use most of the features of CodePen · Need to know how to enable it?
CodePen
codepen.io › ZlatinaNyagolova › pen › LZOgzZ
SImple Popup Div (on button and on link)
Minimize JavaScript Editor · Fold All · Unfold All · // When the user clicks on the button, // toggle between hiding and showing the dropdown content function showPopup() { event.preventDefault(); document.getElementById("popup_content").classList.toggle("show"); return false; } // Close the dropdown if the user clicks outside of it window.onclick = function(event) { if (!event.target.matches('.thePopup')) { var dropdowns = document.getElementsByClassName("popup_content"); var i; for (i = 0; i < dropdowns.length; i++) { var openDropdown = dropdowns[i]; if (openDropdown.classList.contains('show')) { openDropdown.classList.remove('show'); } } } } !
CodePen
codepen.io › si-hamada › pen › QGQOrB
PopUp for every Button
$(document).ready(function(){ $('.popUpBtn').on('click', function(){ $('#'+$(this).data('modal')).css('display','block'); }) $('span.close').on('click', function(){ $('.modal').css('display','none'); }) $(window).on('click', function(event){ if (jQuery.inArray( event.target, $('.modal') ) != "-1") { $('.modal').css('display','none'); } }) }) // Get the modal // var modal = document.getElementById('myModal'); // Get the button that opens the modal // var btn = document.getElementById("myBtn"); // Get the <span> element that closes the modal // var span = document.getElementsByClassName("close")
Stack Overflow
stackoverflow.com › questions › 75440724 › popup-not-working-in-browser-but-works-in-codepen
javascript - Popup not working in browser but works in codepen - Stack Overflow
I turned off popup blockers as well and thought that would help but still nothing shows up · document.addEventListener("DOMContentLoaded", function() { var ebModal = document.getElementById("mySizeChartModal"); var ebBtn = document.getElementById("mySizeChart"); var ebSpan = document.getElementsByClassName("ebcf_close")[0]; ebBtn.onclick = function() { ebModal.style.display = "block"; }; ebSpan.onclick = function() { ebModal.style.display = "none"; }; window.onclick = function(event) { if (event.target == ebModal) { ebModal.style.display = "none"; } }; });
CodePen
codepen.io › blayderunner123-the-reactor › pen › vYBVaRW
Button Popup Window onClick
An online code editor, learning environment, and community for front-end web development using HTML, CSS and JavaScript code snippets, projects, and web applications.
CodePen
codepen.io › mahiwebs › pen › gOPXYKp
Simple popup box
Minimize JavaScript Editor · Fold All · Unfold All · //Building Popup const button = document.querySelector('button'); const popup = document.querySelector('.popup-window'); const close = document.querySelector('.close-menu'); button.addEventListener('click', () => { popup.style.display = 'block'; }); close.addEventListener('click', () => { popup.style.display = 'none'; }); popup.addEventListener('dblclick', () => { popup.style.display = 'none'; }); !
Top answer 1 of 4
2
Just use window.open:
var referenceToNewWindow = window.open(url, name, features);
2 of 4
0
function popup(mylink, windowname, w, h){
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, "width="+w+",height="+h+",scrollbars=yes,toolbar=no" );
return false;
}
<a href="http://www.example.com" onClick="return popup(this, 'Title', '400', '500')">Link</a>