Stereobit / dragend

dragend JS – a touch ready, full responsive, content swipe script
http://stereobit.github.com/dragend/
MIT License
485 stars 114 forks source link

New methods: refresh / initialize #35

Open siamkreative opened 10 years ago

siamkreative commented 10 years ago

Hey there,

Normally I would use SwipeJS for mobile sliders. But I think it's time to move on as the SwipeJS repo seems to not be maintained much... That's why I tried dragend JS and I like it so far! Great job you did.

Unfortunately, I need to be able to initialize / refresh dragen manually on window.resize(). Here is what I'm trying to achieve: a Bootstrap 3 grid on desktop that turns into a touch slider on mobile.

So far, here is what I've done: http://jsfiddle.net/SiamKreative/baz8504y/1/ (notice the setTimeout is here so that dragen has time to initialize).

Cheers

Stereobit commented 10 years ago

Hey, dragend is observing resize itself: https://github.com/Stereobit/dragend/blob/master/dragend.js#L370

Isn't this enough?

siamkreative commented 10 years ago

Thanks for your prompt answer :)

What am I doing wrong? I want dragend to show up only on mobile.

siamkreative commented 9 years ago

Hey @Stereobit,

Could you please take a look at the demo I prepared and explain me why dragend sets the height of each "page" to 1698px? It should be much less than that... Do you know why the height calculation is wrong?

Any help would be appreciated :+1:

Cheers


On my latest tests, I was able to figure out that the calculated height was sum of the height of each page (each item is 566px | 3*566 = 1698)... Maybe this can help.

Stereobit commented 9 years ago

Dragend gets the current height off the container and set's it as the page height. Just set the height of the container to the height you want the pages.

siamkreative commented 9 years ago

That's an issue with responsive sites like the one I'm working on. I can't set a fixed height (or max-height) for the container...

schrink commented 9 years ago

great plugin! any solution for this problem? I am also having the height of container set as sum of all elements height. the problem is that on a responsive site I can't set the fixed height.

natalitique commented 9 years ago

same problem, lovely plugin but would need the height to be set to the longest element, or total height divided by amount of elements