Created
February 7, 2014 22:42
-
-
Save leoneed/8873523 to your computer and use it in GitHub Desktop.
Untitled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="wrap"> | |
<button>Click Me</button> | |
<button>Click Me</button> | |
<button>Click Me</button> | |
<button>Click Me</button> | |
<button>Click Me</button> | |
<button>Click Me</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var showPopup = (function () { | |
var popup; | |
function getPopup () { | |
if (!popup) { | |
popup = document.createElement('div'); | |
popup.innerHTML = 'Popup Content';alert(document.body); | |
document.body.appendChild(popup); | |
} | |
return popup; | |
} | |
return function () { | |
} | |
})(); | |
document.getElementById('wrap').onclick = function (e) { | |
if (e.target.tagName === 'BUTTON') { | |
showPopup(); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment