Last active
March 12, 2020 15:58
-
-
Save Newol1/2f974101066b52800de7b5581712197d to your computer and use it in GitHub Desktop.
JavaScript Self Libraries
This file contains 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
function popUp(popUp_content, popUp_container) { | |
let elem = $(popUp_content); | |
let container = $(popUp_container) | |
if (!container.hasClass("show__pop-up-container")) { | |
container.addClass("show__pop-up-container"); | |
} | |
$(document).on("mouseup", function em(e) { | |
if (!elem.is(e.target) && elem.has(e.target).length === 0 && container.hasClass("show__pop-up-container")) { | |
$(document).off("mouseup", em, true); | |
container.removeClass("show__pop-up-container"); | |
} | |
}) | |
} |
This file contains 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 pathname = window.location.pathname; // Returns path only (/path/example.html) | |
var url = window.location.href; // Returns full URL (https://example.com/path/example.html) | |
var origin = window.location.origin; // Returns base URL (https://example.com) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment