My favorites | Sign in
Project Home Downloads Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
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
Status:  Fixed
Owner:  ----
Closed:  Jun 2008


 
Reported by bar...@gmail.com, May 1, 2008
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
Good idea, I didn't think about this callback.
As it's not a big feature, I'll wait for a more changes or bug fix to release a new
version. The code is already added in my local test version.

in your code, instead of using
currentSettings.endRemoveCallback != null
It's better to test like that:
jQuery.isFunction(currentSettings.endRemoveCallback)

Moreover, to be consistent with the other callback, the name of this new one will be:
endRemove. And this function will also takes the 2 arguments elts and settings
like every others callbacks

Maybe you can change your code to be usable with the next version ;)

Thanks for your suggest, have a good time using it!

For the record, what do you need to do once the modal is gone?
May 2, 2008
#3 bar...@gmail.com
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
Project Member #4 nyro...@gmail.com
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
Project Member #5 nyro...@gmail.com
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
#6 gaborsza...@gmail.com
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
#7 gaborsza...@gmail.com
Got it:
$(function() {
	  $.fn.nyroModal.settings.endRemove = function() { alert("modal is gone!"); };
	});

Powered by Google Project Hosting