Adaptation for mobile
-
Hi there!
First of all, I really like this slider a lot! It’s free and has all the cool stuff available to use.
But I have a problem with it while trying to adopt my web-site(and the slider) for a mobile-friendly version.
You see, the mobile version MUST be light-wight(less mb – faster load), so I disable big images(background-images) with display:none with my @media queries, so it will be as light as possible. However, even tho the images of the CrellySlider are background-images(means I can display:none on them) I cant disable them. They are loaded each time. The thing is, the slider change the DOM, so when @media queries try to “display:none” on them, they changed back with JS.Is there anyway I can make this more mobile-friendly, so the images of the slider(and the layers of each one of them) will not load for mobile versions?
I’m not a big expert(he-he), I don’t know JS, but perhaps this rule(of code) would help to solve the problem:
if (document.documentElement.clientWidth < 600) {
// disable all the scripts related to the slider on the loading, so it won’t load unnecessary images of the slider, will disable the layers of the slider and DOM changing
}
elseif (document.documentElement.clientWidth < 900) {
// disable all the scripts(as before), but load another slider(created special for this) without layers and with different images(of course)
}
if (document.documentElement.clientWidth > 900) {
// use normal slider
}Thanks in advance!
The topic ‘Adaptation for mobile’ is closed to new replies.