Skip to content

Instantly share code, notes, and snippets.

@ykob
Created February 5, 2016 10:03
Show Gist options
  • Save ykob/f9584f333a1fbfeb00a5 to your computer and use it in GitHub Desktop.
Save ykob/f9584f333a1fbfeb00a5 to your computer and use it in GitHub Desktop.
simple popup.
export default class Popup {
constructor($elm) {
this.$elm = $elm;
this.href = $elm.attr('href');
this.name = '';
this.width = 600;
this.height = 400;
};
init(name, width, height) {
if (name) this.name = name;
if (width) this.width = width;
if (height) this.height = height;
const _this = this;
this.$elm.on('click', function() {
_this.open();
return false;
});
};
open() {
window.open(
this.href,
this.name,
`width=${this.width},height=${this.height}`
);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment