Jump to content
Sue Busher

Resizing photos to work on mobile

Recommended Posts

Hi

I am still having problems getting the photographs on the slideshow (using old HTML as opposed to widget) to resize correctly for mobile devices. They stretch vertically. Any help would be gratefully received. Below is the HTML I am using (linked to the file drop) - the reason we are using this instead of the widget is that any of the admins can easily remove and reorder the photographs - not so easy with the widget.

<style>
.carousel-fade .carousel-inner .item {
opacity: 0;
-webkit-transition-property: opacity;
-moz-transition-property: opacity;
-o-transition-property: opacity;
transition-property: opacity;
}
.carousel-fade .carousel-inner .active {
opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
left: 0;
opacity: 0;
z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
opacity: 1;
}
.carousel-fade .carousel-control {
z-index: 2;
}
.carousel-inner img {
max-width: 100%;
max-height: 300px;
margin-left: auto;
margin-right: auto;
min-width: 300px;
}
.carousel-arrow-left,
.carousel-arrow-right {
top: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 15px;
margin-top: -15px;
}
.carousel-arrow-right {
left: 10%;
border-left-color: #FFFFFF;
}
.carousel-arrow-left {
right: 10%;
border-right-color: #FFFFFF;
}
    #carousel_davids {
        text-align: center;
    }
    #filedrop-slide-show-count_david {
        display: inline-block;
        position: relative;
    }
    @media screen and (max-width:350px) {
.carousel-inner img {
            max-width: 100%;
            max-height: 100px;
        }
    }
</style>
<div id="carousel_davids" class="carousel slide carousel-fade col-lg-8 col-offset-2">
<ol id="filedrop-slide-show-count_david" class="carousel-indicators">
</ol>
<div id="filedrop-slide-show-img_david" role="listbox" class="carousel-inner">
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#carousel_davids" data-slide="prev">
<span class="carousel-arrow-left"></span>
</a>
<a class="right carousel-control" href="#carousel_davids" data-slide="next">
<span class="carousel-arrow-right"></span>
</a>
</div>
<!--
This section brings back a list of the file names, uncomment if you wish this to be displayed
<ul id="filelist"></ul>
-->
<script type="text/javascript">
$('.carousel_davids').carousel();
var baseURL = Frog.Utilities.getBaseUrl(),
// Change fileDropUuid to the UUID of your file drop widget
fileDropUuid_david = '4722B7DA200286ED1D2DBF15F192130EA69350FCBFE0873C' ;
Frog.Model
.api('filedrop.get', {
filedrop: fileDropUuid_david
}).done(function(filesResponse) {
var $fileList = $('#filelist'),
$slideShowCount = $("#filedrop-slide-show-count_david"),
$slideShowImageContainer = $("#filedrop-slide-show-img_david"),
fileCount = 0;
filesResponse.data.resources.forEach(function(file , index) {
// Check whether the file is one of these filetypes; Want to add more? Add to the array
if (['jpg', 'jpeg', 'gif', 'png'].indexOf(file.file.ext.toLowerCase()) > -1) {
if ($fileList.length) {
// This only runs when you have uncommented the the HTML code above
// This code adds file names to the ul#filelist
$fileList.append(
$('<li>').text(file.file.name)
);
}
$slideShowCount
.append(
$('<li>')
.attr('data-target', 'Carousel')
.attr('data-slide-to', fileCount)
.addClass(function() {
if (fileCount === 0) {
return 'active';
}
})
);
$slideShowImageContainer
.append(
$('<div>').addClass('item')
.addClass(function() {
if (fileCount === 0) {
return 'active';
}
})
.append(
$('<img />').addClass('img-responsive')
.attr('src', baseURL + '/app/file/resource/' + file.file.uuid)
.attr('align', 'center')
)
);
fileCount++;
}
});
});
</script>

I can PM you a link to the site if you think you can help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...