Comments (3)
Seems to be a webkit problem:
http://stackoverflow.com/questions/8118640/safari-ie-image-map-custom-cursor-not-working-properly
If this is really important functionality, you can basically code your own image map functionality and prevent the browser from using the real one. Here is an example.
http://jsfiddle.net/jamietre/M6jBp/
What I've done is:
- Reorder the images after ImageMapster binds so that the imagemap no longer has the highest z-index. This stops the browser from reacting to it in any way. It also makes ImageMapster not work at all when you mouse over something.
- So to deal with that, we have to manually figure out what area someone's in and call imagemapster manually to highlight/select areas when they do something. The code I linked to only addresses "highlight" but could easily be updated to do selects too.
There are several caveats with that code.
-
It only deals with polygons. This is by far the most complex case though - rectangles are a piece of cake. Circles are a bit more work, but if you look at "tooltip.js" in the imagemapster source, there is code to map a circle to polygon coordinates which should work fine for them.
-
This is doing a lot of work. The pnpoly function has to check against all the coordinates of every area to see if the mouse is inside it on every mouse move event. This is what your browser is doing behind the scenes for imagemaps. Of course that code is written in C. We've re-written that in javascript. It's going to be way slower. It seems to work just fine in Chrome, with only a few areas. I bet it would cripple IE6 on a larger imagemap. Again, ways around this - set the "mousemove" function to call it less often using a timeout. Make sure it's finished before you call again. The logic could be optimized by first building a list of rectangular outer boundaries for each area to narrow the list down to a few before calling pnpoly each time. Not impossible to resolve - just more work.
Anyway - this is a possible solution, obviously, it requires a lot of coding to solve a very small issue and get around a very silly browser issue. I'd already written the code to detect mouse pointer in area so it was easy enough to give you a demo of a way to do this. Whether you want to chase it down to a finished product is up to you, I guess it depends how important the custom cursor is.
from imagemapster.
Thank you for that response - you did a lot of work very quickly. I wanted to verify that there wasn't some small thing that could be changed to make this work. I agree - I have to see if I can talk the client out of this requirement :) Either way I have a much better understanding of the problem now.
from imagemapster.
Have you tried setting display: block
on the area element? http://stackoverflow.com/a/16047186/300038
from imagemapster.
Related Issues (20)
- Visual 'selection' cannot be removed via API when `staticState === true`
- area w/ `staticState === false` that has been selected via API becomes unselected when clicking another area
- `select`/`set` options not applied or not applied correctly
- Change tooltips dinamically HOT 1
- singleSelect not respected when `selected` === true on map config and/or multiple area config HOT 1
- Rename default branch to main HOT 4
- Uncaught RangeError: Maximum call stack size exceeded when includeKeys has circular reference
- Inconsistent/Unexpected behavior when clicking area that has includeKeys
- onConfigured not called after rebind
- areas appears selected in UI after rebind even though its selected state !== true HOT 1
- some options (e.g. wrapClass) are not applied after rebind
- onGetList not called when isSelectable !== true
- tests not waiting for onConfigured before continuing
- [📘] rebind docs are not correct regarding preserving selected state
- jsFiddle demos are all broken HOT 6
- Incorrect reference to navigateMode config option name
- Safari's OCR/Live Text is blocking image zones HOT 3
- [TouchScreen only] Weird highlight glitch when touch on the other area beside the map. HOT 5
- this.activeToolTip.stop is not a function HOT 2
- Export image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagemapster.