javascript - Set global instance of toastmessage using akquinet jquery toast message plugin -


i using jquery plugin show toast message on click of button given condition. , when click on button new toast message shown. want show 1 toast message being shown on click of button meaning, should not show toast message when first toast message still on screen.

is there way have global instance of , showing same each time rather show new 1 ?

any appreciated. in advance.

you use boolean remember if toast message displayed. see jsfiddle (forked official demo). use mytoast variable "boolean" in similar way.

$(document).ready(function() {    		var isdisplaying = false;      var yourtext = 'success dialog not sticky',          toastmessagesettings = {              text: yourtext,              sticky: false,              position: 'top-right',              type: 'success',              closetext: '',              close: function() {                  console.log("toast closed ...");                  isdisplaying = false;              }          };          $('#mybutton').click(function() {      	if ( ! isdisplaying) {            var mytoast = $().toastmessage('showtoast', toastmessagesettings);            console.log('mytoast:');            console.log(mytoast);            isdisplaying = true;          }                });    });
<script src="http://akquinet.github.com/jquery-toastmessage-plugin/demo/jquery.toastmessage-min.js"></script>  <link href="http://akquinet.github.com/jquery-toastmessage-plugin/demo/css/jquery.toastmessage-min.css" rel="stylesheet"/>      <h1><a href="http://github.com/akquinet/jquery-toastmessage-plugin">jquery-toastmessage-plugin demo</a>          <br/><span class="small">by <a href="http://github.com/akquinet">akquinet</a></span></h1>    <button id="mybutton">press it</button>


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -