Skip to content

Instantly share code, notes, and snippets.

@matchy256
Created December 27, 2016 23:38
Show Gist options
  • Save matchy256/2022fbc0d4b80a0d85780a1093edef6b to your computer and use it in GitHub Desktop.
Save matchy256/2022fbc0d4b80a0d85780a1093edef6b to your computer and use it in GitHub Desktop.
jQuery Mobile 1.4系で簡易なポップアップメッセージ
function jqmSimpleMessage(message) {
var parent = $('.ui-page-active');
if (parent.length === 0) {
parent = $('body');
}
var div = $('<div data-role="popup" id="__popupmsg" class="ui-content" data-theme="a"></div>');
div.append($('<p></p>').text(message));
var a = $('<a href="#__popupmsg" data-rel="popup" data-position-to="window" id="__popupkicker">popup</a>');
a.css('display', 'none');
parent.append(div).trigger('create');
parent.append(a).trigger('create');
$('#__popupkicker').click().remove();
div.delay(800).fadeOut(400, function(){
$(this).remove();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment