Hey, I couldn't for the life of me figure out how to get my dialogs to
fade in and fade out without mucking around the UI source code. My
solution was to create a new effect called fade. The benefit is now
you could use it everywhere where you need fade (untested-I think you
can...) and it won't break when you upgrade your JQuery UI.
I'm a beginner in Javascript, let me know if this works for you :)
Feedback appreciated.
---add to header, include the script:
<script type="text/javascript" src="js/effects.fade.js"></script>
---use this code:
$("#thedialog").dialog({
show: 'fade',
hide: 'fade'
});
---save the below script to "effects.fade.js"
------------------
/*
* jQuery UI fade effect, based on pulsate
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Depends:
* effects.core.js
*/
(function($) {
$.effects.fade = function(o) {
return this.queue(function() {
// Create element
var el = $(this);
// Set options
var speed = o.options.speed || 230;
var mode = o.options.mode || 'show'; // Set Mode
// Animate
if (mode == 'show') {
el.fadeIn(speed);
} else {
el.fadeOut(speed);
};
el.queue('fx', function() { el.dequeue(); });
el.dequeue();
});
};
})(jQuery);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---