Created
August 11, 2014 08:47
-
-
Save carlosrojaso/f1ae967de897db4f0b36 to your computer and use it in GitHub Desktop.
alert with jquerymobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toast(message) { | |
var $toast = $('<div class="ui-loader ui-overlay-shadow ui-body-e ui-corner-all"><h3>' + message + '</h3></div>'); | |
$toast.css({ | |
display: 'block', | |
background: '#fff', | |
opacity: 0.90, | |
position: 'fixed', | |
padding: '7px', | |
'text-align': 'center', | |
width: '270px', | |
left: ($(window).width() - 284) / 2, | |
top: $(window).height() / 2 - 20 | |
}); | |
var removeToast = function(){ | |
$(this).remove(); | |
}; | |
$toast.click(removeToast); | |
$toast.appendTo($.mobile.pageContainer).delay(2000); | |
$toast.fadeOut(400, removeToast); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment