This update to the TinyBox modal box script brings a ton of new features and still clocks in under 5KB. The script now supports iframes and images natively. You can POST with Ajax. Clicking ESC will close the window. Callback functions can be passed for load and close events. You can set CSS IDs to override the default styling. CSS position can be toggled between fixed and absolute. The mask opacity can be sent. You have full control over window location. And of course there is now a close button out of the box you can toggle.
The script is now executed by passing an object due to the large number of options. There is nothing to initialize, just call the function on whatever mouse or browser event you like. A sample call would look like the following:
1 | TINY.box.show({url:'advanced.html',width:300,height:150}) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | html - HTML content for window (string) - falseiframe - URL for embedded iframe (string) - falseurl - path for AJAX call (string) - falsepost - post variable string, used in conjunction with url (string) - falseimage - image path (string) - falsewidth - preset width (int) - falseheight - preset height (int) - falseanimate - toggle animation (bool) - trueclose - toggle close button (bool) - trueopenjs - generic function executed on open (string) - nullclosejs - generic function executed on close (string) - nullautohide - number of seconds to wait until auto-hiding (int) - falseboxid - ID of box div for style overriding purposes (string) - ''maskid - ID of mask div for style overriding purposes (string) - ''fixed - toggle fixed position vs static (bool) - trueopacity - set the opacity of the mask from 0-100 (int) - 70mask - toggle mask display (bool) - truetop - absolute pixels from top (int) - nullleft - absolute pixels from left (int) - nulltopsplit - 1/x where x is the denominator in the split from the top (int) - 2 |
Source link: http://www.scriptiny.com/2011/03/javascript-modal-windows/
No comments:
Post a Comment