0

当用户悬停 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 代码中添加一些东西。

4

1 回答 1

2

+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;
}
于 2011-09-02T12:33:26.087 回答