当鼠标位于div的右边缘时,如何将鼠标光标设置为电子调整大小 [英] how to set mouse cursor as e-resize when mouse is in right edge of the div
本文介绍了当鼠标位于div的右边缘时,如何将鼠标光标设置为电子调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我想调整div.resize的大小,但是我将鼠标指针移至div的右边缘时,鼠标光标必须从指针更改为e-resize.我尝试了以下代码
< div 类 =" >
时间栏
< /div >
. TimeBarDrag {
背景 : 无重复滚动0 0#C1D8FF; 跨度>
边框 : 1像素实线#2A7FFF;
光标 : 电子调整大小;
}
现在光标已在div的所有边缘上从指针更改为e-resize,但我只想在div的右边缘上.有什么可以帮助我摆脱这个问题的方法.
解决方案
您好!
我认为您应该使用jQuery,例如 http://jqueryui.com/demos/resizable/ [ < 样式 > ; #resizable {宽度:150px;高度:150像素;填充:0.5em; } #resizable h3 {text-align:center;边距:0; } < /style > < 脚本 >
(function(){
("#resizable").resizable(); }); < /script > < div =" 演示" < div =" 可调整大小" 类 ui-widget -content" < h3 =" ui-widget-header" > 可调整大小< /h3 < /div > < /div > <!- 结束演示 < div =" class =" > < p > 启用任何DOM可调整大小的元素.用光标抓住右边界或底边界,然后拖动到所需的宽度或高度.< /p > < /div > <!- 结束演示说明 http://rickyelrod.tumblr.com/post/12726746062/jquerys-resizable-of-position-fixed-divs-也 [<div class="TimeBarDrag"> Timebar </div>
.TimeBarDrag { background: none repeat scroll 0 0 #C1D8FF; border: 1px solid #2A7FFF; cursor: e-resize; }
Now cursor has changed from pointer to e-resize on all the edges of the div but I want only on right edge of the div.Can any please help me to get out of this problem.解决方案Hello!
I think you should use jQuery, for example http://jqueryui.com/demos/resizable/[^]:
<style> #resizable { width: 150px; height: 150px; padding: 0.5em; } #resizable h3 { text-align: center; margin: 0; } </style> <script>
(function() {
( "#resizable" ).resizable(); }); </script> <div class="demo"> <div id="resizable" class="ui-widget-content"> <h3 class="ui-widget-header">Resizable</h3> </div> </div><!-- End demo --> <div style="display: none;" class="demo-description"> <p>Enable any DOM element to be resizable. With the cursor grab the right or bottom border and drag to the desired width or height.</p> </div><!-- End demo-description -->
And you could see http://rickyelrod.tumblr.com/post/12726746062/jquerys-resizable-of-position-fixed-divs-also[^].
这篇关于当鼠标位于div的右边缘时,如何将鼠标光标设置为电子调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文