user2520760
user2520760

Reputation: 11

LeanModal Close Button Rails

Hi I am trying to use the leanModal.js script I havn't any real knowledge of JQuery so I might be leaving something out in my question that might be needed to answer, anyway I have it working that the window pops up when I do

$("#new_playlist_add").leanModal({ closeButton: ".modal_close" });

I am trying to get it to show a close button like the example on http://leanmodal.finelysliced.com.au/# but I am not sure how should I go about this?

Upvotes: 1

Views: 1211

Answers (2)

Rohit Kumar
Rohit Kumar

Reputation: 446

You need to create a link of close button inside the modal.

<a href="#" class="modal-close" >Close modal</a>

It will close the modal created by leanModal() function.

Upvotes: 0

Ryan Endacott
Ryan Endacott

Reputation: 9172

It looks like you need to add an element with a class of .modal_close in your modal. Then, clicking it will close the modal.

Here is part of the example from their site:

<div id="signup" style="display: none; position: fixed; opacity: 1; z-index: 11000; left: 50%; margin-left: -202px; top: 200px;">
  <a class="modal_close" href="#">Close</a>
  <p> Hello world</p>
</div>

The key part is that your modal needs to have an element with the same class as you specify when you start the model. You need this:

<a class="modal_close" href="#">Close me!</a>

Upvotes: 1

Related Questions