javascript - Controlling image height in Bootstrap-Lightbox gallery -
javascript - Controlling image height in Bootstrap-Lightbox gallery -
i'm working on website of artist, galleries important. i'm using bootstrap website, , lightbox bootstrap plugin galleries. works fine adjusting width of image resolution (i want create responsive possible). but, can observe if click on vertical photo (for example, 1 in sec row, sec column), when opens, it's bigger screen , can't seen without scrolling.
so, want rid of problem, adjusting maximum height of image height of screen. can't find way this. ideas doing in simple way? i've uploaded website server can see problem: http://mural.uv.es/ivape2/es/galeria.html
thank you.
i had similar problem , tinny77's answer thing approached solution.
here working snippet of ended
class="snippet-code-js lang-js prettyprint-override"> $().ready(function() { $('[data-toggle="lightbox"]').click(function(event) { event.preventdefault(); $(this).ekkolightbox({ type: 'image', oncontentloaded: function() { var container = $('.ekko-lightbox-container'); var image = container.find('img'); var windowheight = $(window).height(); if(image.height() + 200 > windowheight) { image.css('height', windowheight - 150); var dialog = container.parents('.modal-dialog'); var padding = parseint(dialog.find('.modal-body').css('padding')); dialog.css('max-width', image.width() + padding * 2 + 2); } } }); }); });
class="snippet-code-html lang-html prettyprint-override"><html> <head> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js" type="text/javascript"></script> <script class="cssdeck" src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/3.3.0/ekko-lightbox.min.js"></script> </head> <body> <p>click image</p> <a href="http://lorempixel.com/400/1920" data-toggle="lightbox"> <img height="200" src="http://lorempixel.com/400/1920"/> </a> </body> </html>
javascript html css twitter-bootstrap
Comments
Post a Comment