Created
May 14, 2014 08:58
-
-
Save markbain/59c4c9099af8d3b20418 to your computer and use it in GitHub Desktop.
Looks for js-link-popup marked links and makes them open in a popup
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
/* | |
Looks for js-link-popup marked links and makes them open in a popup | |
Optionally allows width and height to be specified in the data attibutes on the <a> | |
*/ | |
function processPopups(){ | |
$("a.js-link-popup").click(function(event){ | |
event.preventDefault(); | |
var link = $(this); | |
var width = parseInt(link.data("width"))||600; | |
var height = parseInt(link.data("height"))||600; | |
window.open(link.attr("href"),'','toolbar=0,resizable=1,menubar=0,scrollbars=1,width='+width+",height=" + height); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment