javascript - 如何在悬停 Google Plus One 按钮时更改光标样式

标签 javascript cursor google-plus-one

我想在用户悬停 Google“+1”按钮时更改光标样式。 我尝试使用 div 标签并添加 style 属性,但它不起作用。

<div class="g-plusone" data-size="tall" style="cursor:wait" ></div>
<script type="text/javascript">
 (function() {
var po = document.createElement('script'); 
po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(po, s);
})();
</script>

我想我们需要在他们的 js 代码中添加一些东西。

最佳答案

+1 是一个具有以下类的按钮:class="esw eswd",悬停时,这些类:class="esw eswd eswh"。你可以用 jQuery 获取这个元素并控制它: 例如:

// with jQuery:
$("button.esw.eswd").each(function(){
    $(this).hover(function(){
        // your mouseover code here:
        $(this).addClass("some-class");
    },function(){
        // your mouseout code here:
        $(this).removeClass("some-class");
    });
});

///////////////
// or with css:

button.esw.eswd{
    // mouseout style here
}
button.esw.eswd.eswh{
    // mouseover style here
    cursor:wait;
}

关于javascript - 如何在悬停 Google Plus One 按钮时更改光标样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7283222/

相关文章:

javascript - JS 提升功能。 (为什么这个代码片段有效?)

jquery - 分享 Google Plus 计数器始终显示为零

ajax - 什么样的 json 答案以 )]}' 开头

javascript - Angular2 RC2 - 快速启动项目无法生成 2 个 .umd.js 文件

javascript - 如何对 Javascript 对象或对象数组进行排序?

javascript - HTML/JS的Windows屏幕保护程序

java - 是否可以只用一个查询来检索分成三个表的对象?

html - 鼠标光标适用于一个 gif 而不是另一个

java - Android 使用不同的工具

java - googlecredential没有这样的方法错误