Skip to content

Instantly share code, notes, and snippets.

@drrobotnik
Created March 1, 2014 02:36
Show Gist options
  • Save drrobotnik/9284159 to your computer and use it in GitHub Desktop.
Save drrobotnik/9284159 to your computer and use it in GitHub Desktop.
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index 6ae41ab..98330c3 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -12,6 +12,7 @@ jQuery(document).ready(function($) {
type: 'ajax',
ajax: {
settings: {
+ verticalFit: true,
dataType: 'html'
}
},
@@ -22,6 +23,9 @@ jQuery(document).ready(function($) {
} else if(data.status === 'error') {
}
},
+ open: function() {
+ $('.mfp-wrap').css({'overflow':'hidden'});
+ },
close: function() {
// destroy the slider to avoid memory leaks
this.content.find('.royalSlider').remove();
diff --git a/app/views/public_shots/show.html.erb b/app/views/public_shots/show.html.erb
index 8c3d426..9b6fa14 100644
--- a/app/views/public_shots/show.html.erb
+++ b/app/views/public_shots/show.html.erb
@@ -17,15 +17,6 @@
<% end %>
<div class="sliderContainer">
- <div class="sub-head">
- <div class="wrapper-narrow">
- <div class="grid">
- <div class="grid__item one-half text--left"><i class="amigo-grid dropcaps visuallyhidden--palm"></i><%= @shot.event.name %><br />
- owner info | 09.24.13 | san diego</div>
- <div class="grid__item one-half text--right"><button title="Close (Esc)" type="button" class="mfp-close">×</button></div>
- </div>
- </div>
- </div>
<div class="royalSlider rsDefault sliderInLightbox">
<% @shots.each do |shot| %>
<%= link_to "", shot.photo.url(:download, false), class: "rsImg" %>
@@ -40,12 +31,14 @@
</div>
<script>
jQuery(document).ready(function($) {
- var maxHeight = window.outerHeight;
- var heightRatio = window.outerWidth/(800/500);
- var height = ( heightRatio <= maxHeight ) ? heightRatio : maxHeight;
+ $(window).on('resize',function(){
+ var maxHeight = window.innerHeight-62;
+ $('.mfp-container').height(maxHeight);
+ $('.mfp-container').css({'max-height':maxHeight});
+ });
/* initialize slider as usual */
$('.sliderInLightbox').royalSlider({
- //imageScaleMode: 'fit-if-smaller',
+ imageScaleMode: 'fill',
keyboardNavEnabled: true,
numImagesToPreload:1,
autoScaleSlider:true,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment