Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to close modal programmaticaly #22

Closed
aquam8 opened this issue Aug 19, 2011 · 1 comment
Closed

Add method to close modal programmaticaly #22

aquam8 opened this issue Aug 19, 2011 · 1 comment

Comments

@aquam8
Copy link

aquam8 commented Aug 19, 2011

Cory [suggested to add the following to the reveal source code to enable the modal to be close programmaticaly (from Javascript).
[http://stackoverflow.com/questions/4884369/how-do-i-programmatically-close-an-open-jquery-reveal-js-modal-box]

$.fn.hideModal = function(options){
var self = this,
modal = $(self),
topMeasure = parseInt(modal.css('top'));
$('.reveal-modal-bg').css({'display' : 'none'});
modal.css({'visibility' : 'hidden', 'top' : topMeasure});
}

and use
$('#your_modal_box').hideModal()

That's well worthwhile.

Thank you Cory!

@mkelly12
Copy link

Hey Matt,

You can close (or open) the modal with the current code by triggering the reveal open or close event.

$('#yourModal').trigger('reveal:close');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants