单击后将光标设置为等待

时间:2013-02-06 08:43:57

标签: css

当我点击一个按钮时,光标不会改变加载。任何想法如何实现这一目标?

这是我的代码:

<div class="signup">
    <input type="submit" value="Sign Up" title="SignUp" id="SignUp" class="btn" />
</div>  

的CSS

#SignUp
{
    float: left;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
    vertical-align: central;
    margin-top: 0px;
    width: 100px;
    color: white;
    background-color: #5BB75B;
    background-image: -moz-linear-gradient(top, #62C462, #51A351);
    background-image: -ms-linear-gradient(top, #62C462, #51A351);
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62C462), to(#51A351));
    background-image: -webkit-linear-gradient(top, #62C462, #51A351);
    background-image: -o-linear-gradient(top, #62C462, #51A351);
    background-image: linear-gradient(top, #62C462, #51A351);
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);
    border-color: #51A351 #51A351 #387038;
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
    margin-left: 10%;
}

1 个答案:

答案 0 :(得分:3)

您可以使用jQuery绑定到按钮的onclick事件,然后在正文/页面内容上设置一个类,该类将导致光标等待。

// Javascript
$(function() {
  $('input#SignUp').click(function() {
    $('body').addClass('cursor_wait');
  }
});

/* CSS */
.cursor_wait {
  cursor: wait
}