javascript - how to give default alert function behaviour to qtip 2 alert -


i using qtip2 displaying alert messages web application ( shown @ http://craigsworks.com/projects/qtip2/demos/#dialogues )

my code

1) dialogue

function dialogue(content, title) {     /*      * since dialogue isn't tooltip such, we'll use dummy     * out-of-dom element our target instead of actual element document.body     */     $('<div />').qtip(                 {                     content: {                         text: content                        , title: {                            text: 'pmgsy ',                            button: 'close'                        }                     },                     position: {                         my: 'center', at: 'center', // center it...                         target: $(window) // ... in window                     },                     show: {                         ready: true, // show straight away                         modal: {                             on: true, // make modal (darken rest of page)...                             blur: false, // ... don't close tooltip when clicked                             escape: false                         }                     },                     hide: false, // we'll hide maunally disable hide events                      style: {                         classes: 'qtip-shadow qtip-rounded qtip-dialogue', // optional shadow...                         widget: true //themeroller                     },                      events: {                         // hide tooltip when buttons in dialogue clicked                         render: function (event, api) {                             $('button', api.elements.content).click(api.hide);                         },                         // destroy tooltip once it's hidden no longer need it!                         hide: function (event, api) { api.destroy(); }                     }                 }); } 

2) call alert

function alert(message) {     // content consist of message , ok button     var message = $('<p />', { text: message }),     ok = $('<button />', { text: 'ok', 'class': 'full' });     dialogue(message.add(ok), 'alert!'); } 

the problem when use ,its not block further processing until user click on ok button (like default alert function).

e.g alert not show up.

alert("customised alerts"); //this doesent show       window.location.replace("/home/startpage"); 

how make custom alert mimic default alert function ? please help

replace

ok = $('<button />', { text: 'ok', 'class': 'full' }); 

with

ok = $('<button />', { text: 'ok', 'class': 'full' }).click(function(){     window.location.replace("/home/startpage"); }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -