BBKing
BBKing

Reputation: 2299

set time for close colorbox after submit iframe

I send form data using php in colorbox(lightbox) ifarme method. so i close auto if form true submitted . my problem is when form true submitted i show any success box and print your message is Sent . if i set auto close colorbox user not see this success box and Immediately close lightbox. i need to close lightbox after time' e.x : 5seconds' after user see sucessbox. There is a way for this?

my success and colorbox close function :

echo '<div class="success">Thanks.Your Message Send. This Page Close After 5 seconds</div>';

<script type="text/javascript">
<!--//--><![CDATA[//><!--
parent.jQuery.colorbox.close();
//--><!]]>
</script>

Thanks

Upvotes: 0

Views: 4957

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318508

Try this:

window.setTimeout(function() {
    $.colorbox.close();
}, 5000);

I don't think colorbox uses an iframe to display its contents, so no parent necessary. If it does, simply use parent.$.colorbox.close(); instead.

Upvotes: 5

Related Questions