JSFiddle - React, Tailwind, and code Playground
by apoucoz
HTML
<div url="http://apo-ucoz.com" rel="external" id="apoucoz">Клик</div>
CSS
#apoucoz {
width:50px;
height:50px;
background:#eee;
}
JavaScript
/*
* newWindow: a jQuery plugin
*
* Licensed under the MIT:
* http://www.opensource.org/licenses/mit-license.php
*
*/
(function ($) {
$.extend($.fn, {
newWindow: function (options) {
var defaults = {
open: function () {}
};
options = $.extend(defaults, options || {});
return this.each(function () {
$(this).click(function (e) {
e.preventDefault();
var newWindow = open($(this).attr('url'));
options.open.call(newWindow, e);
});
});
}
});
})(jQuery);
$('#apoucoz').newWindow();