想要为更大尺寸的光标使用自定义图像.解决这个问题的方法是什么?有可能用javascript来做吗?
Want to use custom image for cursor of bigger size. What is the workaround for that? Is it possible to do it with javascript?
$('#dustingBrush').unbind('click').bind('click' , function () {
$(".section, window.parent.document").css({"cursor": "url("+localImagePath + data.brushPointer1+"),pointer"});
$(this).css("display" , "none");
});
游标图像来自json,但当我使用更大尺寸的图像时,它并没有反映出来,但是它在较小的图像中工作得很好。
请建议我解决这个问题的方法。
谢谢…
请参阅https://developer.mozilla.org/en-US/docs/Web/CSS/cursor/url的限制部分Firefox允许您使用128×128px图像。较大的图像被忽略。根据本文,您应该将自己的大小限制为32×32,以最大限度地与操作系统和平台兼容
解决方法是隐藏光标并使用包含较大图像的尾随div。
这将模拟更大游标的行为。
示例CSS, html和jquery如下所示。
CSS:#replacePointer {
position: absolute;
cursor:none;
}
HTML: <div id="replacePointer"><img src="http://www.w3schools.com/images/w3logotest2.png" /></div>
Jquery: $(document).bind('mousemove', function(e){
$('#replacePointer').css({
left: e.pageX -10,
top: e.pageY -10
});
});
相关文章:
- 文档.编写方法问题
- 使用Ajax的问题's发送多个值的Post方法
- 在对象中添加方法时出现问题
- 简单的javascript方法问题
- Node.js-异步方法调用问题
- 尝试将变量传递到对象中时的作用域问题'的方法构造函数
- 谷歌地图API v3 addDomListener方法问题
- 角度非幂等方法问题
- 如何使用 2 个表单集并保存它们(发布方法问题)
- Javascript Array.push 方法问题
- 在对象数组上划线查找方法问题
- Jquery.click()出现了一个unanonymus方法问题
- Javascript私有方法问题
- Javascript拼接方法问题
- Javascript对象方法问题
- Object.getPrototypeOf(0)方法问题
- Javascript:添加属性方法问题
- j查询切换方法问题
- Javascript RegExp - 测试方法问题
- 下拉菜单-单选按钮列表和Javascript方法问题