当鼠标位于标签上时,要动态更改标签文本的字体 [英] To dynamically chage font the label text whenever mouse located on label
本文介绍了当鼠标位于标签上时,要动态更改标签文本的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我添加标签,并将文本属性指定为欢迎标签",并且字体大小为默认值.
当我将鼠标移到标签控件上并运行页面后,text属性的字体会随着设置最大大小而增加,反之,当标签丢失鼠标时,文本字体会设置为默认状态.
我将使用Java脚本而不是jquery解决上述问题吗??
请任何人帮帮我....
I add a label & assign the text property is ''Welcome label.'' & font size is default.
After running the page when i locate the mouse onto label control, font of the text property is growing as setting maximum size & reversely, when lost the mouse from label, font of the text is set to default state.
I will i solve the above problem using java script, not jquery????
Please please help me anybody....
推荐答案
像这样的事情吗?
Something like this one?
<style>
#highlighter {
width: 250px;
height: 100px;
border: 1px solid red;
position: absolute;
display: table;
text-align: center;
}
#highlighter p {
vertical-align: middle;
display: table-cell;
}
.h_down p {
font-size: 30px;
}
.h_up p {
font-size: 50px;
}
</style>
<script>
function up(element) {
element.className="h_up";
}
function down(element) {
element.className="h_down";
}
</script>
<div id="highlighter" class="h_down" onmouseover="up(this);" onmouseout="down(this);"><p>let's see</p></div>
更改字体是使用CSS完成的.
因此,您应该在CSS中具有更改字体大小的label:hover
属性,或者具有动态执行相同操作的hover
事件监听器.
使用firebug检查您的标签样式.
Changing font is done using CSS.
So, you should have alabel:hover
property in your CSS that change the font size or you have ahover
event listener who is doing the same dynamically.
Check your label style using firebug.
这篇关于当鼠标位于标签上时,要动态更改标签文本的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文