I have buttons to zoom-in or zoom-out content. In firefox cursor works well (its like magnifier with +
). But in chrome I have default cursor. This is my code:
.button.zoom-in {
...
cursor: zoom-in;
}
Can someone help me, why that works in forefox and in chrome not? Also, other cursors like help, move, pointer... works in chrome too.
If your mouse does not have a wheel, hold the Windows key and + (plus) or - (minus) to increase or decrease magnification.
The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead of this property, if possible. However, unlike CSS Transforms, zoom affects the layout size of the element.
Answer: Use the CSS cursor property You can define a custom cursor using the CSS cursor property. The cursor property takes the comma-separated list of user-defined cursors value followed by the generic cursor. First of all create cursor image and save it with the extension .
For Chrome you have to use the prefixed-property-value:
.button.zoom-in {
...
cursor: -webkit-zoom-in;
cursor: zoom-in;
}
Here is a jsfiddle.
This page from Mozilla is an excellent reference to different cursors as well as browser compatibility for each.
For the zoom-in and zoom-out cursors, the following should work for Chrome 1.0+, Firefox 1.0+, Opera 11.6+ and Safari 3.0+. Zoom-in/out is not supported by IE.
.button.zoom-in {
cursor: -moz-zoom-in;
cursor: -webkit-zoom-in;
cursor: zoom-in;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With