foundation / foundation-sites

The most advanced responsive front-end framework in the world. Quickly create prototypes and production code for sites that work on any kind of device.
https://get.foundation
MIT License
29.66k stars 5.48k forks source link

Reveal - problem with setting option #1847

Closed ivayloc closed 11 years ago

ivayloc commented 11 years ago

Hi, I try to set an option for Reveal but it doesn't work:

$(document).ready(function() {
 $(document).foundation();    
   $('#gr-js-header__money-exchange').foundation('reveal', {
       closeOnBackgroundClick: false
    });
});

Could you tell me what I did wrong?

mrsweaters commented 11 years ago

I pushed an update that should allow you to do this: https://github.com/zurb/foundation/commit/711a594e3325dca941d9e865490c6870e8980c4a

$(document).ready(function() {
 $(document).foundation().foundation('reveal', {
       closeOnBackgroundClick: false
    });
});

Let me know if this works.

ryanbond commented 11 years ago

We are having the same problem with the closeOnBackgroundClick: false not working with the latest commit. Other options can be set but this option closeOnBackgroundClick doesn't seem to work.

mrsweaters commented 11 years ago

Is this in all browsers?

ryanbond commented 11 years ago

Yeah happens in all browsers.

gabrielfgularte commented 11 years ago

I have same problem here with Foundation 3. data-closeonbackgroundclick is not working. Did you guys figrued how to fix?

grassriots commented 11 years ago

Same problem here. I cannot set: $(document).foundation().foundation('reveal', { closeOnBackgroundClick: false });

mrsweaters commented 11 years ago

I just pushed a fix for this, it will be released in 4.1.2, or you can patch Foundation with the current Reveal in the mean time.

grassriots commented 11 years ago

Hey thanks!

I've been using Foundation for numerous projects - and been able to integrate it with Engaging Networks donation pages. The results have been awesome. https://hsi.netdonor.net/ea-action/action?ea.campaign.id=19536&ea.client.id=104

Thanks for the awesome work.

On 2013-04-10, at 12:49 PM, Jordan Humphreys notifications@github.com wrote:

I just pushed a fix for this, it will be released in 4.1.2, or you can patch Foundation with the current Reveal in the mean time.

— Reply to this email directly or view it on GitHub.

mrsweaters commented 11 years ago

@grassriots Nice! Looks great. I always like to see how Foundation gets integrated.

grassriots commented 11 years ago

This is HSI's first foray into mobile - so we're going to see if there is a verifiable increase in donations with this Form.

On 2013-04-10, at 1:14 PM, Jordan Humphreys notifications@github.com wrote:

@grassriots Nice! Looks great. I always like to see how Foundation gets integrated.

— Reply to this email directly or view it on GitHub.

andreortiz82 commented 11 years ago

Same issue... I was able to keep reveal from being dismissed on background click but while this keeps the popup in place the reveal-bg gets dismissed... balls!

$("#modal").foundation('reveal','open').on('opened', {closeOnBackgroundClick: false});
mrsweaters commented 11 years ago

@andreortiz82

Did you try:

$(document)
  .foundation()
  .foundation('reveal', {closeOnBackgroundClick: false});
BowlingX commented 11 years ago

Same here but close event's doesn't work either.

gabrielfgularte commented 11 years ago

Hey, @mrsweaters. You could post here the code snippet, or files that have been modified to make it work?

Thank you!

mrsweaters commented 11 years ago

Are you using Foundation 4.1.2? The code I posted above works in that version.

mrsweaters commented 11 years ago

Sorry, I originally had onBackgroundClick, it is supposed to be closeOnBackgroundClick. I've updated it.

gabrielfgularte commented 11 years ago

I haven't made the upgrade fyet, and many of my projects are still in version 3. Is there a fix for version 3?

BowlingX commented 11 years ago

is it not possible to control closeOnBackgroundClick per instance? @mrsweaters solution work's but will set it globally. same problem with event handlers onClose onOpen ...

mrsweaters commented 11 years ago

Reveal now supports data-options on the modals thanks to this commit: https://github.com/zurb/foundation/commit/dab93b65dce948a2384cd4dcd3c0124e0a03a63d

You can now do something like this for individual modals:

<div id="firstModal" class="reveal-modal" data-options="closeOnBackgroundClick: false;">
  <p>Modal content.</p>
  <a class="close-reveal-modal">&times;</a>
</div>

This will be released in Foundation 4.1.3 and is now available in master if you want to patch your release.

bartn commented 9 years ago

For documentation purposes: within data-options one should use 'close_on_background_click' instead of the above proposed 'closeOnBackgroundClick'.