| Issue 14: | New Feature: custom callback to be called at end of endRemove() | |
| 2 people starred this issue and may be notified of changes. | Back to list |
I had a need for a custom callback function to be called when the nyroModal
has completely finished so that I can trigger new events. I went ahead and
added this to the code myself. I am posting here what changes I made to the
source of version 1.2.4, and if you'd like to incorporate it into the main
source, please do so :)
Here's what I did to jquery.nyroModal-1.2.4.js:
1. Added new entry to the default settings section of:
endRemoveCallback: null // custom callback for after endRemove()
2. Added a block to the end of existing endRemove() function:
if (currentSettings.endRemoveCallback != null) {
// execute custom callback function
currentSettings.endRemoveCallback();
}
3. Here is an example of how I set and use this new feature:
$(this).nyroModalManual({
height: 590,
endRemoveCallback: function() { alert("modal is gone!"); }
});
What version of the product are you using? On what operating system?
1.2.4 on Windows XP Pro x64
Please provide any additional information below.
If there is a different way to accomplish this same behavior that I have
missed, please let me know. Thanks again for the great plugin!
May 2, 2008
Project Member
#2
nyro...@gmail.com
May 2, 2008
Thank you. Your changes are well received -- I've updated my code to reflect your suggestions so that my app will be compatible with your next release. I agree this change does not warrant its own release, but I'm glad you chose to include it in the next release :) Here is how I am using it: I use nyroModal to bring up a "contact form" on my company's website. When they click a contact link in the navigation menu, it "highlights" the contact link, and removes the "highlight" from whatever page was originally highlighted, then opens the modal form. In the background, the navigation is still visible, showing 'contact' as highlighted. After the user has submitted the form, the nyroModal window closes down and THEN (here is where I use the new callback, endRemove), it removes the highlight from the 'contact' link, and restores the originally highlighted navigation entry. I can give you the private link to my site which is still under development if you would like to see this in action. Just let me know. cheers, -Ben
May 2, 2008
no that's fine, I understood what you do, and this new callback is exactly what you need, no way to do it in an other way to keep something graceful. Don't hesitate to send a link once your site is live!
Jun 1, 2008
As I added a new important functionality for fix the issue #21 , I released a new version. This new version contains the change you requested here. So don't hesitate to update your js files with it.
Status:
Fixed
Jun 26, 2008
I'm a bit stuck on the custom callback,
$(function() {
$.nyroModalSettings({endRemove: function() { alert("modal is gone!"); }});
});
Am i doing something wrong?
Jun 26, 2008
Got it:
$(function() {
$.fn.nyroModal.settings.endRemove = function() { alert("modal is gone!"); };
});
|