Как изменить стиль курсора при наведении на кнопку Google Plus One - PullRequest
0 голосов
/ 02 сентября 2011

Я хочу изменить стиль курсора, когда пользователь наводит на 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 Ответ

2 голосов
/ 02 сентября 2011

+ 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;
}
...