For a given image of class=’camview’ this jQuery javascript will scroll back a variable amount depending on the mouse location over the image.
The mouse over right edge of the image represents the most recent image from the archive. The bottom-left corner represents 24 hours ago. But to have finer granularity at reviewing more recent images, scrolling the mouse over the top of the image will scroll back one time-increment every 10 pixels. Moving the mouse from right to left over the bottom of the image will scroll back over a full 24 hours (1440 one-minute images) skipping frames as needed to fit the mouse resolution. Mouse heights between the top and bottom edges will have a linearly scaled proportion of archive history.
1 2 3 4 5 6 7 8 9 10 | $( '.camview' ).mousemove( function (event) { var x = event.pageX - $( this ).offset().left; var y = event.pageY - $( this ).offset().top; var mindx = 0.1; var maxdx = 1440.0 / $( this ).width(); var dy = 1.0 - y / $( this ).height(); var dx = dy * mindx + (1.0-dy) * maxdx; var arc = ($( this ).width() - x) * dx; $( this ).find( 'img' ).attr( 'src' , 'camjpg.php?cam=' + $( this ).attr( 'id' ) + '&arc=' + arc.toFixed(0)); }); |