dorien dorien - 4 months ago 24
Javascript Question

Preventing crosshair from moving on hover with flot

I have a plot drawn with flot in javascript.

I continuously set the crosshair position so that it is in sync with an audioPlayer.

this.crossHairPos = newAudioPosition;
x: this.crossHairPos

However, when I move my mouse over the plot the crosshair moves to my mouse. I think I should maybe use lockCrosshair, but I haven't succeeded yet:

lockCrosshair({x: this.crossHairPos});


This JSFiddle demonstrates setting, locking, and unlocking the crosshair without issue.

You'll want to use both the lockCrosshair and unlockCrosshair function:

$('#lock-crosshair').on('click', function() {
    x: 4

$('#unlock-crosshair').on('click', function() {