How to know if the pointer is going to left or right in ionic-angular range component

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to know if the pointer is going to left or right in ionic-angular range component



I wan’t to know if there is a way to find pointer direction on ionic range component. I mean if pointer is going to left or right?



Thanks for your help





What did you try? If i were you i would inspect ionChange event to see if it contains what you need, if not directly you can calculate delta between values and conclude where its going.
– Sergey Rudenko
Aug 12 at 7:22




1 Answer
1



Alright here is how you can do it:



https://stackblitz.com/edit/ionic-qnxrnv



Basically you have your range (I used default one which is 0 to 100 values):





And you bind method to detect the movement:


sliderValueChanged(event)
// if current slider value exist we can do comparision:
if (this.currentSliderValue && (this.currentSliderValue > event.value))
console.log("moving left");
else
console.log("moving right")

// now we capture result
this.currentSliderValue = event.value



Depending on your use case you may need to account for different situations when value equals etc etc





Thank you so much. That's what i'm seeking!
– Hanif
Aug 13 at 5:39






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered