dragging image with transparent background - javascript

I use kineticjs example from this page http://www.html5canvastutorials.com/labs/html5-canvas-animals-on-the-beach-game-with-kineticjs/.
Everything works fine- i can move, drag image (kinetic.image) etc. The problem is when i press cursor on transparent area of image, dragging doesn't work then. What to do to make image draggable irrespective of that i press cursor on drawed region or transparent background of this image?

Try removing lines 121 and 122. The page is loading a script that is not being shown that changes the dragable region to the non-transparent parts. For more info look here
Lines to remove:
animal.cache();
animal.drawHitFromCache();

Related

Image not visible in magnified preview in website

I added a Image Zoom in my website using the following instruction: https://www.w3schools.com/howto/howto_js_image_zoom.asp
But after adding that image not visible in zoomed box while mouse over the image.Its appear blank inside.
Thanks

Hide a part of an image on hover

Here is what I'm trying to do :
Have 2 divs one under the other. The bottom one is displaying an image and the up one is let's say white.
On hover, I want the white one to hide so that we can see the one under, with like its opacity down to 0 so it's transparent.
The things is, it should only show a part of that div with a transparent gradient circle around it, following the mouse's course.
Don't mind the white rectangle, it's about the background : the UP div would be a white fullscreen div, whereas the bottom one would be the sky, and when hovering with the mouse we would only see a part of the sky.
Do you guys have any idea on how I could do that, using HTML, css and/or JQuery? :/
one solution would be using a white PNG with a transparent gradient hole in it as the background of the upper div
then with onHover="script..." you set the position of the upper div
both divs must have absolute positioning so one gets on the top of the other

Javascript - How to create an image using canvas based on pixel colors on the site?

I have a site where it has div tags with background colors, and I use relative positioning to move them all together so it looks like an image. I moved them so its exactly on the top left of the page.
How do I create an image out of it, so like if there was a button, when it gets clicked, it creates an image of width 608px and height 105px, and then asks the user if they want to save it or open it or close it (standard download box)?
I would need to get the pixel color starting from index (0,0) right?
Instead of using background images on divs, just draw images onto a canvas. Then take a look at this http://www.html5canvastutorials.com/advanced/html5-canvas-save-drawing-as-an-image/

Rollover image hides the element below from mouse. How to fix?

Here is an example I've put together to better illustrate this problem:
http://www.saeidmohadjer.com/users/saeid/sandbox/javascript/image_map_rollover/test3/test3.html
When you go from image A area to image B area or reverse, there are locations where the rollover doesn't show because the image map below is covered with transparent area of rollover image. Is there a way to make the rollover image hidden from mouse? In ActionScript I could do this by setting an object's mouseEnable property to false to get it out of the way, but I don't know how I can do this in HTML/JavaScript.
The rollover image (pink) is absolute positioned with a higher z-index above the black & white image. The practical usage is for highlighting floorplans on a floorplate of a building whenever mouse rolls over a floorplan.
Thanks,
Saeid
I don't know if this would work for your situation, but an easy way to do it could be to make your black & white image partially transparent (instead of white) and put the pink image below it (that is, give it a lower z-index). Does that help at all?

image drag using javascript

I have an image which i don't want to drag but i want to get that effect.
for example :- I clicked on the image and without leaving the mouse if I moved the mouse over the whole screen. I don't want the image to move but a blur copy of image should move with my mouse.
regards,

Categories