Skip to content
This repository has been archived by the owner on Nov 9, 2019. It is now read-only.

Add a by slide parameter for waiting time #1

Closed
pcoupet opened this issue Apr 19, 2012 · 8 comments
Closed

Add a by slide parameter for waiting time #1

pcoupet opened this issue Apr 19, 2012 · 8 comments

Comments

@pcoupet
Copy link

pcoupet commented Apr 19, 2012

The new automation module is really great. I think it will be a nice improvement to be able to override the default display time for each slide.
I'm thinking of 3 use cases:

  • Wait more time after a specific slide (title, last slide, complex slide ...)
  • Go faster for small nested slides like bullet points
  • Create some animation effects like displaying a pile of images
@rchampourlier
Copy link
Owner

Yes, that would be a nice feature to have.

Any idea on where to specify the chosen delays? I thought of HTML 5 data- attributes, but I don't know if this would be compatible with non-HTML 5 browsers... We may use additional classes on the .slide elements too.

And thanks for the feedback :)

@pcoupet
Copy link
Author

pcoupet commented Apr 19, 2012

Additional classes seems a good idea. This way people may just change the timing by editing css properties. It looks cleaner to me than editing hard-coded time values in the html.
Besides, few different timing values will be needed for a slide deck so it's not a burden to add few css classes. People may have classes like "bullet-point-timing" , "long-slide-timing" ... and so on and can tune easily the exact time allowed for each class later.

@rchampourlier
Copy link
Owner

We have a winner! Thanks to @nemec, we have solved this issue and completed all current TODOs! His pull request is pulled in master.

His solutions uses HTML 5 data-duration attribute to implement custom slide duration, so we may still want to add the possibility to use CSS classes, but that's really nice improvements! Thanks @nemec!

@imakewebthings
Copy link

Awesome that this and the rest of the TODOs were resolved so fast. Just want to respond to something that was said earlier:

I thought of HTML 5 data- attributes, but I don't know if this would be compatible with non-HTML 5 browsers...

Since version 1.4.3 jQuery reads all the data-* attributes and fills their values into the .data() jQuery function. So if you give an element data-duration="5000" you can then say thatSlideElement.data('duration') and it will return the string 5000. This has the same effect as the attr call @nemec used here: https://github.com/rchampourlier/deck.automatic.js/blob/master/automatic/deck.automatic.js#L37 with the caveat that the data function is populated via attributes only once on load, but does manage to mock the native data attribute handling in modern browsers for all of the jQuery supported ones. So no worries about compatability.

@nemec
Copy link
Contributor

nemec commented Apr 20, 2012

What do you think about ignoring the timeout if a negative value is inserted? I know there is debate over whether there's a difference between 24 days and Infinity in browsers, but apparently setTimeout is limited to 32-bit values -- there doesn't seem to be a canonical "32 bit max value" accessible in Javascript (Number.MAX_VALUE and Infinity both overflow), so users would have to just insert a large "magic number" which might cause confusion.

As for use cases, I'd like a way to disable the default transition time. Most of the time I only want one or two slides to move automatically, so a way to disable it globally would be helpful.

@rchampourlier
Copy link
Owner

Hi,

Thanks @imakewebthings for the explanation on the data-* attributes!

@nemec I'm not really aware of the debate. Personally I think that negative values is simple and understandable, so since you're good at keeping the documentation updated, I have no worry about this!

I understand your example use case and I'm pretty sure I may have it some day, so if you need this I will be happy to pull your next pull request.

Thanks for the help!

@rchampourlier
Copy link
Owner

Closing this issue, the remaining work to allow use of classes instead of the data-duration attribute is now in issue #2.

@pcoupet
Copy link
Author

pcoupet commented Apr 23, 2012

Works perfectly!

Thanks a lot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants