Travis build: 448
This commit is contained in:
@ -1862,8 +1862,9 @@ A hover effect where the gradient follows the mouse cursor.
|
||||
```js
|
||||
var btn = document.querySelector('.mouse-cursor-gradient-tracking')
|
||||
btn.onmousemove = function(e) {
|
||||
var x = e.pageX - btn.offsetLeft - btn.offsetParent.offsetLeft
|
||||
var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
|
||||
var rect = e.target.getBoundingClientRect()
|
||||
var x = e.clientX - rect.left
|
||||
var y = e.clientY - rect.top
|
||||
btn.style.setProperty('--x', x + 'px')
|
||||
btn.style.setProperty('--y', y + 'px')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user