dieulot / instantclick

InstantClick makes following links in your website instant.
instantclick.io
MIT License
5.51k stars 246 forks source link

"data-delay" for per-link delay property #68

Open liviucmg opened 10 years ago

liviucmg commented 10 years ago

It would be useful to support a "data-delay" or similar attribute that overrides the delay option used in InstantClick.init(delay);.

For example, my website has full screen image galleries on which the users usually scroll idly, resulting in a lot of mouseover hits. It would be awesome to use InstantClick.init(50); for most of the links, and <img data-delay="mousedown"> for the gallery images. In this case 'mousedown' would override '50'.

Would you be accepting a pull request for this?

Cheers!

dieulot commented 9 years ago

At the moment I’m not considering adding this feature (but I reserve the right to change my mind in the future). I think it’ll add too much complexity.

In your case I recommend just using ‘mousedown’ for everything.

dieulot commented 9 years ago

Considering. This (delay), no delay, mousedown, each configurable for any container or link.

I’m currently not sure how to best implement this, so a pull request won’t be accepted.

What I’m thinking for now though, is data-instant="delay in ms|mouseover|mousedown".

Update: Also, data-instant="pjax" or something like that for no preloading at all, while still using pjax.