A div of mine (teamheading) can be scrolled directly by the user. It can also be scrolled as a result of moving the grid below it.
When the user taps and holds (this is a question relating to use on mobile) on the teamheading div and moves it back and forth, I want the grid to scroll with it.
I've got this so far.
$(document).ready(function() {
$('.teamheading').on('scroll', function() {
//get left scroll position of team heading
var teamheading = $(this).scrollLeft();
//get left scroll position of teamtimematrix
var teamtimematrix = $('.teamtimematrix').scrollLeft();
// check if mouse is clicked down on teamheading
var mouse_is_clicked_down_on_teamheading = ? ? ? ?
//if mouse is clicked down and holding on teamheading
if (mouse_is_clicked_down_on_teamheading == true) {
//if the scroll positions aren't the same, move teamtimematrix to match
if (teamheading != teamtimematrix) {
$(".teamtimematrix").scrollLeft(teamheading);
}
}
});
});
Unfortunately, I don't know how to detect whether or not the user is currently holding down on the teamheading div.