responsive design - Foundation 5 Orbit Slider inside Reveal Modal has no Height -
here jsfiddle demonstrating following issue.
i'm using foundation 5 framework , trying include orbit slider inside of reveal modal, reason slider not given appropriate height.
<-- button reveal modal --> <a href="#" data-reveal-id="mymodal" data-reveal class="button radius">click modal</a> <!-- modal popup revealed --> <div id="mymodal" class="reveal-modal" data-reveal> <ul data-orbit> <li><img src="http://placekitten.com/400/300" /></li> <li><img src="http://placekitten.com/400/300" /></li> <li><img src="http://placekitten.com/400/300" /></li> </ul> </div>
note if resize browser window modal open, automatically corrects appropriate height. issue existed in previous versions of foundation, hacky fixes popped this:
$('.reveal-modal').on('opened', function(){ $(this).find('[data-orbit]').css('height',''); $(window).trigger('resize.fndtn.orbit'); });
however fix no longer works in newest version of foundation. there way working?
note don't want assign min-height css attribute content in slider of variable height, not mention responsive pixel value wouldn't work.
in short believe answer:
$(document).foundation(); $('.reveal-modal').on('opened', function(){ $(window).trigger('resize'); });
or
$(document).foundation(); $(document).on('opened', '[data-reveal]', function () { $(window).trigger('resize'); });
i looked @ following references:
- foundation 4.1.2: orbit slider not shown in reveal window
- the 1 listed "hacky fixes" above
- squashed picture when using orbit in reveal
- orbit height not set on accordion.
it looks old hack 4.1.2 called compute_dimension
method resize modal once opened. looked in foundation.orbit.js file , found $(window).on('resize', self.compute_dimensions);
, around line 280.
instead of $(window).trigger('resize.fndtn.orbit');
used $(window).trigger('resize');
, removed line $(this).find('[data-orbit]').css('height','');
.
i forked jsfiddle , added changes here.
i hope helps.
Comments
Post a Comment