Highlight image regions on hover with CSS - css

What is the HTML CSS solution for highlighting specific areas of a map/floor plan like this?
http://www.centrecourtshopping.co.uk/store-info/

They use sprite image look here.
Basically, it works like that:
The map with dark-blue regions is completely static.
There is invisible layer on top of it made from small rectangular in their case <a> -- each corresponds to single dark-blue region and posses its its own id.
When cursor is placed over a rectangular with id x the sprite image is nicely aligned with its background (by setting CSS's background-position).
Do not think, this magic would be possible without using JavaScript.

Related

Zoom & crop an image and draw an svg-square on top (in angular)

"A stackblitz is worth a thousand words": https://stackblitz.com/edit/angular-zoom-crop-marker
Basically what I'm trying to do is to have a square drawn above a certain position in an image (<img>), and have that dynamically adjust to the image while being zoomed in / out and cropped. The stackblitz link has 3 views, the basic view which is a plain image, a zoomable view (which I got working as well) and a view where the imaged is "zoomed in and cropped" while being zoomable - This is where I need your help.
Should I crop using object-fit in some way? Is it better if I use a canvas to handle this? I've been at this for a whole day I and I feel my css knowledge is too limited to pull this of.
Bonus question: How would I go about to have the zoom-in zoom-out buttons add/remove one image per row using only css flex-box? (ie: not statically adding x pixles in height and width, but rather increase or decrease the size of each image so that another image is removed or added (per row) while always filling up all the available space)
Thank you in advance!
Managed to solve it myself. stackblitz updated with a working solution.

How do i show a country map and make cities separate by changing color of mouseover

How do i show a country map and make cities separate by changing color of mouseover
I need an Idea how to do it like www.mudah.my site.
Basically how they (http://www.mudah.my/) do is by having 1 normal map image with no country highlighted (actually it looks like they use a couple images but make it like 1 image by placing a transparent div over the top of them).
They have a standard image map applied to this '1' image to define the separate areas and when the user mouses over a relevant part of the map they display a specify section of the highlight image (http://www.mudah.my/img/map_highlight.png) in a specific place on top the the existing image, but behind the 1 main transparent div. Presumably so the links associated with the image map) continues to work.
Hope this helps.

How do I combine full page background with links (or imagemap)?

I know there are many techniques how to stretch the image to the whole page. I like the ones based on "background-size: cover", but if it is justified, I can use another technique. My problem is that I need to hook links to some parts of this background image with some hover effects - imagine a picture on castle in the background highlighting its different parts when you hover them with mouse.
Note:
I prefer imagemap solution, because it allows polygon shaped hotspots.
Note that I do not want components on top of the image having it's own dimensions.

video inside custom shaped border css

I'm not exactly sure about the correct term of what I'm trying to do. But basically I am trying to set a video or flash.swf file inside a custom shaped border (the boarder isn't a perfect square) in the header of my website.
I've provided two pictures of what I mean. The first picture is what I want the page to look like when it first loads. The second picture is what it should look like after the video or flash.swf file loads.
Notice how in the second picture there is an image that fits inside what I am calling the boarder area. Again I do not know the proper term. Any help would be greatly appreciated as I don't even know where to begin to start.
Image 1 http://i.stack.imgur.com/xHhB6.jpg
Image 2 http://i.stack.imgur.com/gJ77g.jpg
Set the wmode="opaque" in the embed / object tag. Then you can overlay the flash file with a png that is transparent in the area you want the flash visible.
the png must be positioned absolute that you can position it right via top/left and for the z-index.

Place grid over map using CSS?

I have a world map image. I would like to place a SQUARE GRID over the entire map. I would like each square (cell grid) to change via mouseover with a border color change and background color change.
The grid needs to be layered over the map, transparent except the borders (which is the grid).
Can I achieve this using CSS or there a better way to do this?
Many thanks.
Erik
I'd suggest using a CSS grid framework as an easy way to produce the grid layout. I'd go for this one as you can easily use create a grid with 0px gutters.
You will need to modify the CSS to make the grid absolute positioned so it sits over the top of your map.
Each element in the grid is a DIV so you can easily attach Javascript events to each one to allow users to control the map. If it's a simple colour change on hover then just use css.
You can make the grid transparent using css too: http://css-tricks.com/css-transparency-settings-for-all-broswers/

Resources