+ 4

Moving image

Is there any way i can move the given code image, when i took my finger anywhere https://sololearn.com/compiler-playground/Wfcg4f0pz70A/?ref=app

30th Aug 2025, 3:42 PM
Pablo🚀
Pablo🚀 - avatar
24 Antworten
+ 5
https://sololearn.com/compiler-playground/WHqIiql7p74v/?ref=app
30th Aug 2025, 4:29 PM
Chitranshi Gupta
Chitranshi Gupta - avatar
+ 3
Pablo🚀 , what you can do is trigger an animation on hover that creates a moving effect, albeit along a predefined path. Here's one approach: https://sololearn.com/compiler-playground/WwUFdwhCdj01/?ref=app
30th Aug 2025, 4:29 PM
Ushasi Bhattacharya
+ 3
Hello, Diligent Dceasso! Welcome to Sololearn! Sololearn is a SELF-LEARNING platform which offers several courses. Consider availing the C++ courses provided here: https://www.sololearn.com/learn/courses/c-plus-plus-introduction (Introduction) https://www.sololearn.com/learn/courses/c-plus-plus-intermediate (Intermediate) However, if you have any question, face any probelm while coding, have a confusion or don't understand, feel free to reach out to the Sololearn community. Feel free to post appropriate questions in the Q&A Discussions forum to get constructive help from others.You may also get helpful feedback and suggestions for enhancements on the the codes you publicly post here. Consider refering to other resources available on the internet, such as: https://www.w3schools.com/cpp/ https://www.geeksforgeeks.org/cpp/c-plus-plus/ https://www.codecademy.com/learn/learn-c-plus-plus https://www.learncpp.com/ https://learn.microsoft.com/en-us/cpp/cpp/?view=msvc-170 Thank you for reaching out. Keep coding!
31st Aug 2025, 4:37 AM
Ushasi Bhattacharya
+ 3
draggable = true doesn't always work from browser to browser
1st Sep 2025, 1:25 AM
BroFar
BroFar - avatar
+ 3
BroFar okay
1st Sep 2025, 1:30 AM
Elnior Loreh
Elnior Loreh - avatar
+ 2
Okay, look: ... <img id="albert"> ... // js code let img = document.getElementById("albert"); img.style.position = "absolute"; img.style.top = 2 + "px"; // or any img.style.left = 58 + "px";
30th Aug 2025, 4:00 PM
Elnior Loreh
Elnior Loreh - avatar
+ 2
not working vro Elnior Loreh
30th Aug 2025, 4:02 PM
Pablo🚀
Pablo🚀 - avatar
+ 2
Pablo🚀 , CSS cannot read the mouse or finger position in real-time. Therefore, it cannot track the mouse or finger position dynamically rather, it can only respond to predefined interactions, like :hover, :focus, etc. or CSS animations. You cannot make an image follow a finger or cursor anywhere on the screen using only CSS. To move an element dynamically following a touch, JavaScript is required.
30th Aug 2025, 4:17 PM
Ushasi Bhattacharya
+ 1
use javascript
30th Aug 2025, 3:54 PM
Elnior Loreh
Elnior Loreh - avatar
+ 1
idk much js that why i ask Elnior Loreh
30th Aug 2025, 3:56 PM
Pablo🚀
Pablo🚀 - avatar
+ 1
You can use JavaScript for create a moving function and CSS for set img position. The move function will move your image.
30th Aug 2025, 4:11 PM
Mila
Mila - avatar
+ 1
Pablo checkout
30th Aug 2025, 5:19 PM
Elnior Loreh
Elnior Loreh - avatar
+ 1
Please teach me C++
31st Aug 2025, 4:14 AM
Diligent Dceasso
Diligent Dceasso - avatar
+ 1
BroFar why did you set draggable=“false”? Is that to override the default behavior? If so why?
31st Aug 2025, 1:16 PM
Zvi
Zvi - avatar
+ 1
Zvi When a developer wants to implement their own custom drag-and-drop behavior using JavaScript, they'll often set draggable="false" on the default elements to prevent conflicts with the browser's built-in behavior. This gives them full control over how the dragging and dropping works.
31st Aug 2025, 1:24 PM
BroFar
BroFar - avatar
31st Aug 2025, 2:10 PM
tranquillite
tranquillite - avatar
+ 1
BroFar i thought so but can you be more specific about why you would want to reinvent a wheel when there is a built attribute for this. In other words what builtin behavior do you want to override and fix.
1st Sep 2025, 12:08 AM
Zvi
Zvi - avatar
0
tranquillite , you code works perfectly fine for clicks or touches. Consider adding draggability to the element.
31st Aug 2025, 2:24 PM
Ushasi Bhattacharya