0

I'm sorry that the title is not descreptive enough... :)

I created a simple jQuery code that helps the user select multiple elements by dragging his mouse over them.

Kind of like the way you can select the hours of a new event by dragging your mouse from 10:00 to 13:30, for example.

The code is long, therefore I uploaded it to codepen:

http://codepen.io/reuvenkarasik/pen/FnHbx

This codepen is actually pretty awesome, so you can select hours by simply dragging your mouse between them. The problem is that if you drag your mouse too fast, you'll see that there are "holes" between the hours. for example, let's say you dragged your mouse between 8:00 and 17:00 too fast, I could bet that some hours, like 12:00 and 14:00 weren't selected. the JS just couldn't respont quickly enough to your mouse movements.

How can I fix it?

thanks you all!

Reuven Karasik
  • 475
  • 5
  • 14
  • I think the script works relatively well. Who pulls that fast with the mouse anyway? Seems a bit redundant to focus on optimizing towards that since the user, if dragging in ultra-speed, probably will in almost all cases simply continue dragging the mouse over the "holes" to complement. – urbz Jul 04 '14 at 08:16
  • It's pretty disturbing to me... I feel furstrated everytime I debug the code and see those holes.. But if there's no solution, I guess there's nothing I can do about it anyway. – Reuven Karasik Jul 04 '14 at 09:38
  • Hmm I would recommend looking into jQuery UI's [**Selectable**](http://jqueryui.com/selectable/) since it seem to have better optimization regarding the issue you're pointing towards. See [**this**](http://jsfiddle.net/uT8Yr/) example I made and try it out. Good luck! – urbz Jul 04 '14 at 10:40

0 Answers0