Closing Mediabox on external command

Closing Mediabox on external command was created by rdrewniak

Posted 11 years 4 months ago #7012
I've rigged up Mediabox CK to hold an individual email form (built with the Fox Contact extension). This email form is within an individual article with the module-based version of the form attached. Essentially, when a user clicks the link to open the Mediabox that they want, it's actually loading an iframe of the page with the form.

Currently, on successful submission of the form, Mediabox displays a "Thank You" page, which is a simple redirection to a specific article. What I would like to do is, once the user reaches the "Thank You" page, and after about 5 seconds or so, close the Mediabox. What I'm thinking is I can simply write (within the "Thank You" page article text box) the code required to timeout and close the Mediabox. Therefore once the page loads, it starts the timer, and after the timeout, closes the box.

I know that this is a pretty significant workaround hack, so if anyone knows of a better idea, I'm definitely open to it. If not, could someone shed some light on what the code is that I would need to execute this plan?

(I apologize if this post is horridly convoluted and doesn't make a bit of sense. I'm running DANGEROUSLY low on caffeine right now...)

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Closing Mediabox on external command

Posted 11 years 4 months ago #7034
hi
the mediabox is based on the iaian7 script, look at this :
iaian7.com/webcode/mediaboxAdvanced#scripting

Ced

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Replied by rdrewniak on topic Closing Mediabox on external command

Posted 11 years 4 months ago #7046
Thank you so very much for your help! Using the parent.Mediabox.close() function, combined with a solid 3rd party jquery timer script ( jchavannes.com/jquery-timer ) I got it to work PERFECTLY. Essentially, I've got a custom class on the thank you page that starts the timer when it loads, and fires the parent.Mediabox.close() funciton when the timer expires.

Thank you, again. I really appreciate your help.

Please Log in or Create an account to join the conversation.

Replied by rdrewniak on topic Closing Mediabox on external command

Posted 11 years 4 months ago #7047
Looks like I spoke too soon...

This is probably going to be a little confusing and odd, but please bear with me...

I've got a list of contacts (individual articles with Fox Contact form modules attached to each one) on my contacts page. When the user clicks on each link, it opens a new page with the form (which is actually in an iFrame, embedded in a modular window. When the form is successfully submitted, the user is redirected to a custom thank you page.

What I WANT to do is when the thank you page loads, it will start a timer, and close the modular window. My thoughts were that I'll add a custom class to an element in the thank you page article, which on load, will trigger the timer and eventually close the window.

I have the correct/working command to fire within the iFrame to close the modular window in the parent window. That's not an issue. However, anytime I try to execute this, it bypasses the jQuery test for that class name, and starts the timer once the iFrame is loaded.

This is the code that triggers the series of events...
Code:
$(document).ready(function(){ //contact window timeout & close $("#mainContent .item-page .thankyou").ready(function(){ var timer = $.timer(function(){ parent.Mediabox.close(); }); timer.set({time:3000, autostart:true}); }); });

I don't know if it's a problem with my code (perhaps someone can see something that I missed). I know that this is VASTLY outside the realm of this forum, but I'm genuinely at my wits end on this.

Please Log in or Create an account to join the conversation.

Replied by rdrewniak on topic Closing Mediabox on external command

Posted 11 years 4 months ago #7053
APPARENTLY I forgot how to code jQuery...

I'm sorry about the last post. I ACTUALLY have it working, now. Thank you again for your help, and I swear to god, I'll stop bothering you.

Please Log in or Create an account to join the conversation.

Time to create page: 0.659 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 740 guests and no members online