【建站服务】河南省舞钢网络推广【舞钢网站优化推广】软文推广-网络推广-网络营销推广网站-网络推广公司-如何做推广-网络推广方案-推广价格-怎样提高网站关键词排名-域名申请
作者: 风兰 . 阅读量: 3 . 发表时间:2022-09-20 19:00:50
上往建站提供服务器空间服务商,百度快照排名,网站托管,百度推广运营,致力于设计外包服务与源代码定制开发,360推广,搜狗推广,增加网站的能见度及访问量提升网络营销的效果,主营:网站公司,百度推广公司电话,官网搭建服务,网站服务企业排名,服务器空间,英文域名等业务,专业团队服务,效果好。
河南省舞钢网络推广【舞钢网站优化推广】软文推广-网络推广-网络营销推广网站-网络推广公司-如何做推广-网络推广方案-推广价格-怎样提高网站关键词排名

当拖拽对象时定位光标。默认情况下,光标是出现在被拖拽对象的中间。使用 cursorAt 选项来指定相对于 draggable 的另一个位置(指定一个相对于 top、right、bottom、left 的像素值)。通过提供一个带有有效的 CSS 光标值的 cursor 选项,来自定义光标的外观。有效的 CSS 光标值包括:default、move、pointer、crosshair,等等。
<!doctype html><html lang="en"><head>
<meta charset="utf-8">
<title>jQuery UI 拖动(Draggable) - 光标样式</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<style>
#draggable, #draggable2, #draggable3 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
</style>
<script>
$(function() {
$( "#draggable" ).draggable({ cursor: "move", cursorAt: { top: 56, left: 56 } });
$( "#draggable2" ).draggable({ cursor: "crosshair", cursorAt: { top: -5, left: -5 } });
$( "#draggable3" ).draggable({ cursorAt: { bottom: 0 } });
});
</script></head><body>
<div id="draggable" class="ui-widget-content">
<p>我总是在中间(相对于鼠标)</p></div>
<div id="draggable2" class="ui-widget-content">
<p>我的光标是在 left -5 和 top -5</p></div>
<div id="draggable3" class="ui-widget-content">
<p>我的光标位置只控制了 'bottom' 值</p></div>
</body></html>查看演示
通过 delay 选项设置延迟开始拖拽的毫秒数。通过 distance 选项设置光标被按下且拖拽指定像素后才允许拖拽。
<!doctype html><html lang="en"><head>
<meta charset="utf-8">
<title>jQuery UI 拖动(Draggable) - 延迟开始</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<style>
#draggable, #draggable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 0 10px 10px 0; }
</style>
<script>
$(function() {
$( "#draggable" ).draggable({ distance: 20 });
$( "#draggable2" ).draggable({ delay: 1000 });
$( ".ui-draggable" ).disableSelection();
});
</script></head><body>
<div id="draggable" class="ui-widget-content">
<p>只有把我拖拽了 20 像素后,拖拽才开始</p></div>
<div id="draggable2" class="ui-widget-content">
<p>不管 distance 是多少,您都必须拖拽并等待 1000ms 后拖拽才开始</p></div>
</body></html>查看演示
draggable 上的 start、drag 和 stop 事件。拖拽开始时触发 start 事件,拖拽期间触发 drag 事件,拖拽停止时触发 stop 事件。
<!doctype html><html lang="en"><head>
<meta charset="utf-8">
<title>jQuery UI 拖动(Draggable) - 事件</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css">
<style>
#draggable { width: 16em; padding: 0 1em; }
#draggable ul li { margin: 1em 0; padding: 0.5em 0; } * html #draggable ul li { height: 1%; }
#draggable ul li span.ui-icon { float: left; }
#draggable ul li span.count { font-weight: bold; }
</style>
<script>
$(function() {
var $start_counter = $( "#event-start" ),
$drag_counter = $( "#event-drag" ),
$stop_counter = $( "#event-stop" ),
counts = [ 0, 0, 0 ];
$( "#draggable" ).draggable({
start: function() {
counts[ 0 ]++;
updateCounterStatus( $start_counter, counts[ 0 ] );
},
drag: function() {
counts[ 1 ]++;
updateCounterStatus( $drag_counter, counts[ 1 ] );
},
stop: function() {
counts[ 2 ]++;
updateCounterStatus( $stop_counter, counts[ 2 ] );
}
});
function updateCounterStatus( $event_counter, new_count ) {
// 首先更新视觉状态...
if ( !$event_counter.hasClass( "ui-state-hover" ) ) {
$event_counter.addClass( "ui-state-hover" )
.siblings().removeClass( "ui-state-hover" );
}
// ...然后更新数字
$( "span.count", $event_counter ).text( new_count );
}
});
</script></head><body>
<div id="draggable" class="ui-widget ui-widget-content">
<p>请拖拽我,触发一连串的事件。</p>
<ul class="ui-helper-reset">
<li id="event-start" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-play"></span>"start" 被调用 <span class="count">0</span>x</li>
<li id="event-drag" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-arrow-4"></span>"drag" 被调用 <span class="count">0</span>x</li>
<li id="event-stop" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-stop"></span>"stop" 被调用 <span class="count">0</span>x</li>
</ul></div>
</body></html>查看演示
河南省舞钢网络推广【舞钢网站优化推广】软文推广-网络推广-网络营销推广网站-网络推广公司-如何做推广-网络推广方案-推广价格-怎样提高网站关键词排名
上往建站提供搭建网站,域名注册,官网备案服务,网店详情页设计,企业网店,专业网络店铺管理运营全托管公司咨询电话,服务器空间,微信公众号托管,网页美工排版,致力于域名申请,竞价托管,软文推广,全网营销,提供标准级专业技术保障,了却后顾之忧,主营:虚拟主机,网站推广,百度竞价托管,网站建设,上网建站推广服务,网络公司有哪些等业务,专业团队服务,效果好。
服务热线:400-111-6878 手机微信同号:18118153152(各城市商务人员可上门服务)
关键词:网站建设,企业网站,网站制作,网页设计,高端网站建设,企业网站制作,网页制作,制作网站,网站设计,高端网页设计,高端网站设计,做网站,自适应网站


