Skip to content

Instantly share code, notes, and snippets.

@jawinn
Forked from kamranzafar/toast.js
Created March 23, 2014 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawinn/9729363 to your computer and use it in GitHub Desktop.
Save jawinn/9729363 to your computer and use it in GitHub Desktop.
jQuery Mobile - Toast-style popup, modified
// JQuery Mobile Android-style Toast popup
// https://gist.github.com/kamranzafar/3136584
// Usage: toast("Your Message Here");
var toast = function(msg){
$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h4>"+msg+"</h4></div>")
.css({ display: "block",
opacity: 0.96,
"background-color": "#332C2C",
"z-index":"9999",
position: "fixed",
padding: "0",
"text-align": "center",
width: "80%",
left: "10%",
top: $(window).height()/2 })
.appendTo( $.mobile.pageContainer ).delay( 1500 )
.fadeOut( 800, function(){
$(this).remove();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment