Skip to content

Instantly share code, notes, and snippets.

@alexschreyer
Created November 24, 2016 11:02
Show Gist options
  • Save alexschreyer/e742e88bdb8d2b5be18639b0c14b2788 to your computer and use it in GitHub Desktop.
Save alexschreyer/e742e88bdb8d2b5be18639b0c14b2788 to your computer and use it in GitHub Desktop.
Liquid Page JS
// "Liquid Page" -- Make all DIVs on a page draggable
// By A. Schreyer, (c) 2009-2016
// Downloaded from: www.alexschreyer.net
// Based on the Jquery UI themeroller
window.lqpage || (lqpage = {});
lqpage.trString = "";
lqpage.s1 = document.createElement("script");
lqpage.s2 = document.createElement("script");
lqpage.s1.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js");
lqpage.s2.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js");
document.getElementsByTagName("head")[0].appendChild(lqpage.s1);
document.getElementsByTagName("head")[0].appendChild(lqpage.s2);
lqpage.s1.onload = function() {
lqpage.s2.onload = function() {
$("div,ul").draggable();
confirm("LIQUID PAGE: Remove all overflow:hidden styles?\n\nThis will allow you to move everything on this page everywhere \nbut some elements may break due to overflowing text.") && $("div").css("overflow", "visible");
$("a").click(function(a) {
a.preventDefault()
});
alert("LIQUID PAGE: You can now move all DIVs and ULs around!\n\nFirst click an element and then click and drag it. \nLinks are disabled! Reload the page to get back to the original.")
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment