本文介绍了CSS - 创建一个div“可点击”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何渲染一个可点击的div(比如链接,当我用鼠标移动时用小手)。
我有一些像这样的元素:
< div class =teamSelector>一些< / div>
使用这个jQuery:
$('。teamSelector')。click(function(){
// some functions
});
干杯
解决方案你已经在你的例子中使它可点击。如果你想让它看起来可点击,你可以添加一些CSS:
.teamSelector {cursor:pointer; }
或者继续使用jQuery:
.click(function(){do something})。css(cursor,pointer);
游标属性的W3学校引用。
I'd like to know how i can render a div clickable (like a link, with the small hand when i go over with the mouse).
I have some elements like this:
<div class="teamSelector">Some</div>
With this jQuery:
$('.teamSelector').click(function() {
// some functions
});
Cheers
解决方案
You've already made it clickable in your example. If you would like it to "look" clickable, you can add some CSS:
.teamSelector { cursor: pointer; }
Or continuing with jQuery:
.click(function() { do something }).css("cursor", "pointer");
Here is the W3 schools reference for the cursor property.
这篇关于CSS - 创建一个div“可点击”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-02 08:01