|
TABLE
MAKE
CUSTOMIZE
EFFECTS
EFFECTS CYCLE
EFFECTS CYCLES
VIRTUAL BOX
PLUG-IN
GLIDER
|
Custom.Confirm
Do you want confirms from many different operating systems in the same page? You can.
In this example you can see an Apple confirm, a Windows XP confirm, a Windows Vista confirm and a moo.rd confirm. But the Custom Confirms are not normal confirm boxes like standards: you can pick an overlay, decide if enable dragging, set an opacity transition and many, many more. window.addEvent('domready', function() { // IE6 style fix if(Browser.Engine.trident4) { new Asset.css('/examples/1.3.1/custom_confirm/style_ie6.css', {id: 'style_ie6'}); } // APPLE Confirm var cc1 = new Custom.Confirm('', '<b>JavaScript</b> <br /><br /> <span class="little">An Apple Confirm</span>', { content: 'html', draggable: true, text: { confirmButtonText: '', closeButtonText: '', cancelButtonText: '' }, opacify:false, zones: { box: 'box1', head: 'head1', body: 'body1', buttonBox: 'buttonBox1' }, buttons: { closeButton: 'closeButton1', confirmButton: 'confirmButton1', cancelButton: 'cancelButton1' }, overlay: '#D3D3D3', onConfirm: function() { $('confirm1').set('html', '<b>You typed OK with the first confirm</b>'); }, onCancel: function() { $('confirm1').set('html', '<b>You typed Cancel with the first confirm</b>'); }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); } }); // WINDOWS Confirm var cc2 = new Custom.Confirm('<span><b>XP Confirm</b></span>', '<b>JavaScript</b> <br /><br /> <span class="little">A Windows Confirm</span>', { content: 'html', text: { confirmButtonText: '', closeButtonText: '', cancelButtonText: '' }, opacify:false, draggable: false, zones: { box: 'box2', head: 'head2', body: 'body2', buttonBox: 'buttonBox2' }, buttons: { closeButton: 'closeButton2', confirmButton: 'confirmButton2', cancelButton: 'cancelButton2' }, overlay: 'darken', onConfirm: function() { $('confirm2').set('html', '<b>You typed OK with the second confirm</b>'); }, onCancel: function() { $('confirm2').set('html', '<b>You typed Cancel with the second confirm</b>'); }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); } }); // VISTA Confirm var cc3 = new Custom.Confirm('<span>Vista Confirm</span>', '<b>JavaScript</b> <br /><br /> <span class="little">A Vista Confirm</span>', { content: 'html', text: { confirmButtonText: '', closeButtonText: '', cancelButtonText: '' }, opacify:false, draggable:false, zones: { box: 'box3', head: 'head3', body: 'body3', buttonBox: 'buttonBox3' }, buttons: { closeButton: 'closeButton3', confirmButton: 'confirmButton3', cancelButton: 'cancelButton3' }, overlay: 'lighten', onConfirm: function() { $('confirm3').set('html', '<b>You typed OK with the third confirm</b>'); }, onCancel: function() { $('confirm3').set('html', '<b>You typed Cancel with the third confirm</b>'); }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); } }); // MOO.RD Confirm var cc4 = new Custom.Confirm('<span>moo.rd Confirm</span>', '<b>JavaScript</b> <br /><br /> <span class="little">A moo.rd Confirm</span>', { content: 'html', text: { confirmButtonText: '', closeButtonText: '', cancelButtonText: '' }, opacify:true, zones: { box: 'box4', head: 'head4', body: 'body4', buttonBox: 'buttonBox4' }, buttons: { closeButton: 'closeButton4', confirmButton: 'confirmButton4', cancelButton: 'cancelButton4' }, overlay: 'darken', onConfirm: function() { $('confirm4').set('html', '<b>You typed OK with the fourth confirm</b>'); }, onCancel: function() { $('confirm4').set('html', '<b>You typed Cancel with the fourth confirm</b>'); }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); } }); // EVENTS $('ok').addEvent('click', function(event) { event.preventDefault(); cc1.setText('<b>Javascript</b> <br /> <br /> <span class="little">Same Confirm with new text</span>'); cc1.setLight('lighten'); $('change').set('html', '<b>Changed text and light of the first confirm</b>'); }); $('ok2').addEvent('click', function(event) { event.preventDefault(); cc1.create(); }); $('ok3').addEvent('click', function(event) { event.preventDefault(); cc2.create(); }); $('ok4').addEvent('click', function(event) { event.preventDefault(); cc3.create(); }); $('ok5').addEvent('click', function(event) { event.preventDefault(); cc4.create(); }); }); |