Skip to content

Instantly share code, notes, and snippets.

@markbain
Created May 14, 2014 08:58
Show Gist options
  • Save markbain/59c4c9099af8d3b20418 to your computer and use it in GitHub Desktop.
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
/*
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