Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
How do I programmatically close an open jquery.reveal.js modal box?

I am using the Reveal jQuery plugin. http://www.zurb.com/playground/reveal-modal-plugin

I need to programmatically close the model box when I am done with it, however that feature is not including directly with the plugin.

According to Dave in the comments page,

"The code is in there, just need to hook it up to be called programmatically."

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

If your modal's id is 'reveal-modal', then just this line will do it:

$('#reveal-modal').trigger('reveal:close');
over 4 years ago · Santiago Trujillo Report

0

You can do it a couple of ways.

Trigger a click via jquery on the dismissmodalclass element (defaults to 'close-reveal-modal')

 $('.close-reveal-modal').click();

OR

Add this to reveal.js

$.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()
over 4 years ago · Santiago Trujillo Report

0

The modals class is usually 'reveal-modal'. so changing the lookup to be class based rather than id based, makes this work for more cases:

$('.reveal-modal').trigger('reveal:close');
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!