Skip to content

Instantly share code, notes, and snippets.

@ZZR-china
Last active November 30, 2016 10:22
Show Gist options
  • Save ZZR-china/587916632bf43f655e4ed34434b5dc7c to your computer and use it in GitHub Desktop.
Save ZZR-china/587916632bf43f655e4ed34434b5dc7c to your computer and use it in GitHub Desktop.
jquery modal
(function() {
$.fn.extend({
modalShow:function () {
var btnVal = this.attr('data-val');
var $wantModal = $('[val='+btnVal+']');
this.bind('click', function(event) {
/* Act on the event */
$wantModal.removeClass('hide');
});
$wantModal.find('.modal-close').bind('click', function(event) {
/* Act on the event */
close();
});
function close () {
$wantModal.addClass('hide');
}
return this;
},
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment