darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Slidee width calculation issue #200

Open ghost opened 9 years ago

ghost commented 9 years ago

Hello,

I observed a problem with the slidee width caluclation. The width of Slidee if different from the total of item width...

The main issue is about page bullets and prev next buttons that show activated or two much bullets. The issue depend of the browser width and floating number.

example 1: http://jsfiddle.net/pj29P/40/ (in principle 1 page bullets depends of your browser width)

EDIT :

Lolo

darsain commented 9 years ago

I really appreciate the fiddles, unfortunately they don't work for me due to mixed content policies (jsfiddle is https and your external resources are http, so they refuse to load).

Also, could you just paste the minimal needed code to replicate the issue? And not load external CSS files and plugins? Just style it as basically as possible. Also the plugins file has only jquery easing, which is redundant if you leave the easing option to default (best for demos).

For sly, use some of the CDN links, as github pages don't do https. Like this one:

//cdn.jsdelivr.net/sly/1.5.1/sly.min.js

Sorry for the hassle.

ghost commented 9 years ago

The demo is based from one of your fiddle....

http://jsfiddle.net/pj29P/45/

darsain commented 9 years ago

Yeah I know, and I'm sorry about that :) It doesn't work anymore due to problems mentioned above. I think jsfiddle wasn't forcing https back than.

Just replace sly with external link that supports https (posted above), remove external plugins and styles, and style it yourself with minimal styles that replicate the issue.

ghost commented 9 years ago

http://jsfiddle.net/pj29P/46/

darsain commented 9 years ago

Thx. I'll look at it when I'll have some time.

2ramiro commented 8 years ago

Hello I think i have the same problem , the width calculated from sly is not enough so the last item goes into the next line. Here is a Link to my test site where you can see the issue: http://test.kultur.lv/Produkte/asc/alternativ-toner-fuer-oki-b-250025202540okifax-2510okioffice-25102530-hohe-kapazitaet-09004391/3950159 Thanks Ramiro

serafimsaudade8 commented 8 years ago

Did a Pull Request to fix this issue

critcat commented 8 years ago

Yes, there is a problem. When not specified width for each element in the horizontal mode, the width is calculated incorrectly.

As you can see, when you do not set the width value in the css for .frame ul li, the last element is transferred to the new line: https://jsfiddle.net/Lp3hkrms/1/

However, when the width is set, all works: https://jsfiddle.net/16tzrapb/1/

dannevesdantas commented 7 years ago

I have found a simple workaround for this issue:

    // fix for incorrect sly.js width calculation
    // https://github.com/darsain/sly/issues/200
    $(".frame ul li").each(function(index, element) {
        var itemWidth = $(this).outerWidth(); // get item's width
        $(this).css("width", itemWidth); // set item's width in css
    });

Working example at https://jsfiddle.net/dannevesdantas/79vqy0kL/