Comments (4)
You are missing the common sense when working with images. What is happening is that you are calling sly on DOM load when images are not ready, and thus haven't had the chance to resize their containers, so sly is working with elements that are 0x0 px big.
You can confirm that by calling sly('reload') on your frame after the site has been loaded, which fixes the issue immediately.
I suggest you to use plugin like desandro/imagesloaded, and let it to tell you when to call sly, or even better, if the size of the elements is not dynamic, assign it manually in CSS. That will fix the issue, and won't introduce any new dependency or a code requirement.
Not a bug, closing the issue.
from sly.
I puted this on document.ready section:
$("ul.slidee").css("display", "none");
$(".slidee").imagesLoaded( function( $images, $proper, $broken ) {
$("ul.slidee").css("display", "block");
$('#frame').sly(
{
horizontal: 1,
itemNav: "forceCentered",
prev: ".prev",
next: ".next",
dragContent: 1,
scrollBy: 1,
speed: 200,
dynamicHandle: 0,
scrollBar: ".scrollbar",
//easing: "easeOutBack" // with jQuery easing v1.3
});
});
Thank you so much! Yours js-libraries are the greatest! :)
P.S.: trick with $("ul.slidee").css("display", "none"); is to hide all images then they loading.
from sly.
Your "trick" might cause images not to load at all. Browsers won't load images that are display: none;
or within a container with display: none;
. If it works, it is only because you are setting the display: none;
after the images have started with loading, and that is a highly unreliable assumption.
Also, I mentioned that setting the size of your li elements manually in CSS is a better solution than including ImagesLoaded plugin. But, whatever suits you...
from sly.
Width of element "#frame" setting then Sly activated, so I can not to know width of this element before.
Btw, maybe I can to calculate width of #frame by sum of all images widths, by using $images parameter of imagesLoaded( function... ??
from sly.
Related Issues (20)
- One per frame last item breaks depending on OS HOT 1
- MacBook Trackpad scroll
- vertical-align elements
- no Event object on callback called as onActivate handler
- horizontal scroll on android chrome acting in funny way
- active class doesn't change when dragging or touch-dragging
- moveBy cause error in ie8
- append (add) new items in top instead of bottom? (vertical mode) HOT 1
- "scrollBy: 1" scrolls too many items on high res laptop screen
- Set custom position of translateX() in horizontal - not to snap to 1/2nd slide
- How the slider width is detected? How can I increase it? HOT 1
- startAt active item: how to do it?
- Hi, darsain sly I'm moving to more framework support
- moveEnd event occurs twice
- How sly pure library javascript?
- How to add big left and right arrows between the carousel?
- How to change the start Position?
- Auto hide scrollbar HOT 3
- Problem numbers pagesBar with pageBuilder
- trouble calculating the width of the <ul> tag. 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 sly.