Menu icon Foundation

My Posts

No Content

My Comments

Richard LaFranchi commented on Paul Gatt's post about 4 years

Hello,

I know it's been a while since this post was created, but I have a github repo that can be used as a starting point for using foundation for apps with Rails.

Here's the repo:

https://github.com/rlafranchi/foundation-apps-rails

And here's a demo:

https://young-fortress-5170.herokuapp.com/posts

Richard LaFranchi commented on Stéphane Richin's post over 4 years

I don't believe ajax will work for this situation, but you could use a bit of javascript to grab the src from the link and insert it into the modal.

The link would change to something like this:

<a class='image-modal' href="#" data-img-src="/path/to/image.jpg" data-reveal-id="myModal">
    Click Me For A Modal
</a>

And here's the javascript:

 $('a.image-modal').on('click', function() {
  var img = $(this).data('img-src');
  var revealId = $(this).data('reveal-id');
  $('#' + revealId).html('<img src="' + img + '" alt=""/>').foundation('reveal','open');
});

Posts Followed


Following

    No Content

Followers

My Posts

No Content

My Comments

You commented on Paul Gatt's post about 4 years

Hello,

I know it's been a while since this post was created, but I have a github repo that can be used as a starting point for using foundation for apps with Rails.

Here's the repo:

https://github.com/rlafranchi/foundation-apps-rails

And here's a demo:

https://young-fortress-5170.herokuapp.com/posts

You commented on Stéphane Richin's post over 4 years

I don't believe ajax will work for this situation, but you could use a bit of javascript to grab the src from the link and insert it into the modal.

The link would change to something like this:

<a class='image-modal' href="#" data-img-src="/path/to/image.jpg" data-reveal-id="myModal">
    Click Me For A Modal
</a>

And here's the javascript:

 $('a.image-modal').on('click', function() {
  var img = $(this).data('img-src');
  var revealId = $(this).data('reveal-id');
  $('#' + revealId).html('<img src="' + img + '" alt=""/>').foundation('reveal','open');
});

Posts Followed

Following

  • No Content

Followers

  • No Content