Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我想将Jquery mousemove()方法和css()方法转换为纯javascript_Javascript_Jquery_Css_Mousemove - Fatal编程技术网

我想将Jquery mousemove()方法和css()方法转换为纯javascript

我想将Jquery mousemove()方法和css()方法转换为纯javascript,javascript,jquery,css,mousemove,Javascript,Jquery,Css,Mousemove,我正在将Jquery脚本转换为Vanilla JS,我很难转换这段代码: 其中region元素是SVG插图,当鼠标移到上面时,他的位置被捕获(使用pageX和pageY)并插入到html元素中(使用style) jQuery('region')。在('mousemove',函数(e)上{ description.css({ 左:e.pageX, 排名:e.pageY-100, }); });您需要为mousemove添加addEventListener。我建议您在CSS中创建样式,然后根据需要

我正在将Jquery脚本转换为Vanilla JS,我很难转换这段代码: 其中region元素是SVG插图,当鼠标移到上面时,他的位置被捕获(使用pageX和pageY)并插入到html元素中(使用style)

jQuery('region')。在('mousemove',函数(e)上{
description.css({
左:e.pageX,
排名:e.pageY-100,
});

});
您需要为mousemove添加
addEventListener
。我建议您在CSS中创建样式,然后根据需要添加/删除该类。谢谢!使用addEventListener帮助将('mousemove',..…上的jquery转换为javascript事件处理程序:document.querySelector('test')。addEventListener('mousemove',myFunction);