Reputation: 63
When I use the css zoom property, the mouse coordinates are correct on all but two elements : http://seiyria.com/bootstrap-slider/ & https://fullcalendar.io
How do we fix this problem ? Thank you in advance for your help.
Upvotes: 0
Views: 607
Reputation: 63
For fullcalendar.io, I found a solution on Github, it is necessary to edit two functions of the file fullcalendar.js :
function getEvX(ev) {
if (ev.pageX !== undefined) {
return ev.pageX / Number($('body').css('zoom'));
}
var touches = ev.originalEvent.touches;
if (touches) {
return touches[0].pageX / Number($('body').css('zoom'));
}
}
function getEvY(ev) {
if (ev.pageY !== undefined) {
return ev.pageY / Number($('body').css('zoom'));
}
var touches = ev.originalEvent.touches;
if (touches) {
return touches[0].pageY / Number($('body').css('zoom'));
}
}
For bootstrap slider, here's the solution :
var valeurZoom = window.getComputedStyle(document.body, null).getPropertyValue('zoom');
if (valeurZoom !== "" && valeurZoom !== 1) {
eventPosition = eventPosition / valeurZoom;
}
Hopefully it helps other people !
Upvotes: 1