image-comparison-slider | image comparison slider thingy , written in pure | Animation library
kandi X-RAY | image-comparison-slider Summary
kandi X-RAY | image-comparison-slider Summary
A lightweight, before-after, image comparison slider thingy, written in pure javascript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of image-comparison-slider
image-comparison-slider Key Features
image-comparison-slider Examples and Code Snippets
Community Discussions
Trending Discussions on image-comparison-slider
QUESTION
I found this tutorial to create an image comparison slider, which works perfectly on Chrome. However, when I load it on Firefox, the slider does not react at all.
Here an example:
...ANSWER
Answered 2021-May-11 at 19:14That's because is not supported by Firefox. You might prefer using a solution based on the Drag and drop API
QUESTION
I have created the following simple image comparison slider - modified from the version on w3schools (I know my mistake to use their code).
This all works fine on a desktop but when I try to use it on a mobile, nothing happens - it doesn't even register the console.log on the mousedown/touchstart (when I press on the slider button with my finger).
I was wondering if anyone could spot anything obvious with why it isn't working on mobile devices
...ANSWER
Answered 2018-Sep-13 at 13:33Ok have managed to fix this - the touch wasn't registering because of the transform so I changed that and just used negative margin as the button was a fixed size.
I then had to fix the thisEvent.pageX
for android - so did a check with isNaN
and then set it to e.originalEvent.touches[0].pageX
if it was true.
Working version:
QUESTION
There are a lot of "Before & After Comparison Slider". I'm interested in improving it.
Is that possible to slide images without clicking? I mean, divisor(dragger) will be linked to the mouse. When users just hover mouse(without clicking and dragging like now), slides will be changed.
Here are references:
https://codepen.io/dudleystorey/pen/HkwBo
https://codyhouse.co/gem/css-jquery-image-comparison-slider (click demo)
...ANSWER
Answered 2018-Jun-23 at 18:00Yes - and this is already very common on graphics comparison sites and places like Buzzfeed/ClickHole.
I've modified your CodePen demo to use the mousemove
event and therefore not require a click/drag:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install image-comparison-slider
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page