Comments (2)
pew. seems to me that the whole prodecure is flawed. A "debugger;" call reveals, that $(this), the slide, has zero height all of the time.
for me, this works:
if ( autoHeight === 'calc' ) {
// calculate tallest slide index
opts.slides.each(function(i) {
// debugger;
// this one didn't work
// var ratio = $(this).height() / $(this).width();
var ratio = $('img',this).attr('height') / $('img',this).attr('width');
opts.API.log('image '+i+': ratio='+ratio+' | max='+max);
if ( ratio > max ) {
max = ratio;
autoHeight = i;
}
});
}
since I put the height and width of each image in the according attribute. It's neither fully tested, nor a complete solution.
Update:
See live at http://www.dietersteinbach.com/
Resize window to be about 400px wide (minimum possible width in chrome) to see the mobile stylesheet.
from cycle2.
Yeah, that's pretty tricky if you have variable sized images set to 'auto' height. Another approach would be to delay the style initialization until after cycle has a chance to calculate the correct sentinel:
.cycle-slide img { display: block }
$('.slideshow').on('post-intialize', function() {
$('.cycle-slide img').css({ maxWidth: '100%', height: 'auto' });
});
from cycle2.
Related Issues (20)
- Carousel Offset both sides
- How to avoid validation errors with <div class="cycle-slideshow".... tag HOT 1
- Replace $.trim() with String.prototype.trim() HOT 4
- Limit images loaded
- Неработает HOT 1
- issues with latest wordpress update HOT 7
- Captions and Overlay not displaying
- Embed youtube videos
- Slideshow Not Working
- Slides overlap content HOT 5
- Website is broken HOT 2
- I can't turn off the autoplay
- cycle2 stopped working! HOT 3
- When the page refreshes during screen size changes the carousel disappears HOT 1
- Custom Pager Template does not close parsed string
- Are `cycle-update-view-before/after` events safe to use in production code?
- Cycle2 prev/next function not working for me HOT 3
- [Solution] Add endless slides dynamically
- <div class="cycle-slideshow lightbox" data-cycle-prev="#prev-10606" data-cycle-next="#next-10606" data-cycle-pager="#pager-10606"> <!-- IMAGES --> <div id="prev-10606" class="cycle-prev"></div> <div id="next-10606" class="cycle-prev"></div> <div id="pager-10606" class="cycle-prev"></div> </div>
- hasOwnProperty is not a function using jQuery 4.0.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cycle2.