찾다
웹 프론트엔드JS 튜토리얼jquery로 구현된 마우스 드래그 정렬 Li 또는 Table_jquery

1. 프론트엔드 페이지

코드 복사 코드는 다음과 같습니다.






广告管理






















테이블>





2、CSS样式

[css] 일반 복사 보기에서 CODE上查看代码picture派生到我的代码picture

body,div,dl,dt, dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding: 0;}
테이블{border-collapse:collapse;border-spacing:0;}
ol,ul{list-style:none;}

a{color:#333;text- 장식:없음;}
a:hover{color:#f30;text-장식:밑줄}

body{font-family:"宋体",Arail,verdana;font-size:12px;line -높이:1.5em;색상:#222;배경:#fff ;}


.clearfix:after{content:".";display:block;height:0;clear:both;visibility :hidden;}
.clearfix{display:block;}
* html .clearfix{height:1%;}
.clear{clear:both;}

/*文本对齐*/
.tr{text-align:right}
.tl{text-align:left;}
.tc{text-align:center;}

/*浮动* /
.fn-fl{float:left;}
.fn-fr{float:right;}

.m5{margin:5px;} .m10{margin:10px;}
.mt5 { margin-top:5px;}.mr5 { margin-right:5px;}.mb5 { margin-bottom:5px;}.ml5 { margin-left:5px;}
.mt10 { margin- top:10px;}.mr10 { margin-right:10px;}.mb10 { margin-bottom:10px;}.ml10 { margin-left:10px;}

.p5{padding:5px;} . p10{padding:10px;}
.pt5 { padding-top:5px;}.pr5 { padding-right:5px;}.pb5 { padding-bottom:5px;}.pl5 { padding-left:5px;}
.pt10 { padding-top:10px;}.pr10 { padding-right:10px;}.pb10 { padding-bottom:10px;}.pl10 { padding-left:10px;}

. mt30{margin-top:30px;}.mb30{margin-bottom:30px;}
.pt30{padding-top:30px;}.pb30{padding-bottom:30px;}

/*无效状态*/
입력[비활성화], 선택[비활성화], 텍스트 영역[비활성화], 입력[읽기 전용], 선택[읽기 전용], 텍스트 영역[읽기 전용] {배경색: #eee;커서: 허용되지 않음; box-shadow:none;opacity:0.5}

/*下拉列表*/
select{border:1px solid #ccc;border-radius:3px;padding:1px 2px;}

/*输入框*/
input:-moz-placeholder,textarea:-moz-placeholder {color: #999999;}
input:-ms-input-placeholder,textarea:-ms-input- 자리 표시자 {색상: #999999;}
입력::-webkit-input-placeholder,textarea::-webkit-input-placeholder {색상: #999999;}

.txt,textarea,input[ type="text"], input[type="password"] {border: 1px solid #ccc;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;transition: border 0.2s 선형 0s, 상자 그림자 0.2s 선형 0s;border-radius:3px;padding:2px 3px;}
.txt:focus,textarea:focus,input[type="text"]:focus, input[type="password" ]:초점 {테두리: 1px 솔리드 #2C5193;상자 그림자: 0 1px 1px rgba(0, 0, 0, 0.075) 삽입, 0 0 8px rgba(44, 81, 147, 0.6);}
.txta {글꼴 크기:12px;라인 높이:18px;}
.txt20{너비:20px;}
.txt30{너비:30px;}
.txt50{너비:50px;}
.txt75{너비:75px;}
.txt85{너비:85px;}
.txt100{너비:100px;}
.txt125{너비:125px;}
.txt150{너비:150px ;}
.txt175{너비:175px;}
.txt200{너비:200px;}
.txt250{너비:250px;}
.txt280{너비:280px;}
. txt300{너비:300px;}
.txt350{너비:350px;}
.txt400{너비:400px;}

/*标准表格*/
.fn-table{너비 :100%;}
.fn-table>tbody>tr>td{padding:3px;배경:#fff;border:1px solid #CEDCED;}
.fn-table>tbody>tr>th{ 배경:#E3F5FF;패딩:2px;테두리:1px 솔리드 #CEDCED;글꼴-가중치:굵게;}

.fn-table-space>tbody>tr:nth-child(2n 1)>td {배경:#efefef;}

/*细线表格*/
.fn-table-line>tbody>tr>td{}

/*鼠标hover表格*/
.fn-table-mouse>tbody>tr:nth-child(2n 1)>td{배경:#efefef;}
.fn-table tr.on>tbody>tr>td,.fn -table-mouse>tbody>tr:hover>td{배경:#FCF8E3;}

/*功能表格*/
.fn-table-function>tbody>tr>td:nth-child (2n 1){배경:#E3F5FF;텍스트-정렬:right;글꼴-가중치:bold;}
.fn-table-function>tbody>tr>td:first-child{배경:#E3F5FF;text- align:right;font-weight:bold;}

/*干净表格*/
.fn-table-clear{}
.fn-table-clear>tbody>tr>td{ 패딩:3px;배경:#fff;테두리:없음;}
.fn-table-clear>tbody>tr>th{배경:#E3F5FF;패딩:3px;border:none;}

/*iframe 头part样式,仅后台part案例*/
.fn-iframe-hd{padding:2px 5px;배경:#2C5193;margin-bottom:30px;line-height:22px;height:22px;color :#fff;위치:고정;왼쪽:0;상단:0;너비:100%;}
.fn-iframe-hd .close{배경:url(/Manager/Themes/images/icons/closed.png ) 반복 없음 센터 center;float:right;width:14px;height:13px;cursor:pointer;padding:4px 5px;margin-right:10px;}
.fn-iframe-hd .close:hover{opacity :0.8;}
.fn-iframe-hd .tt{float:left;font-weight:bold;}

/*标准Tab选项卡*/
.fn-tab .hd li{float:left;margin-right:2px;padding:2px 5px;border:1px solid #2C5193;border-radius :5px 5px 0 0;커서:포인터;배경:#2C5193;색상:#fff;}
.fn-tab .hd li.on{배경:#4B8AF9;색상:#fff;경계:1px 단색 #4B8AF9 ;border-bottom:0;}
.fn-tab .bd{border:1px solid #ddd;padding:3px;margin-top:-1px;}
.fn-tab .bd div.item{ 디스플레이:없음;}
.fn-tab .bd div.on{display:block;}

/*搜索框*/
.fn-searchbar{border:1px solid #CEDCED; padding:2px;border-radius:3px;}
.fn-searchbar 입력,.fn-searchbar 선택{vertical-align:middle;}

/*分页*/
.fn- 호출기{배경:#E3F5FF;border:1px solid #CEDCED;margin:0 0 5px;border-top:0;}
.fn-pager div{line-height:26px;white-space:nowrap;word- break:break-all;}
.fn-pager 입력{margin-left:5px;}
.fn-pager a{border:1px solid #E3F5FF;padding:3px 5px;}
.fn -pager span.on{배경:#2C5193;border:1px solid #2C5193;color:#fff;padding:3px 5px;font-weight:bold;}
.fn-pager a:hover{배경:#2C5193 ;border:1px solid #2C5193;color:#fff;}
.fn-pager 입력,.fn-pager 선택,.fn-pager a,.fn-pager 범위{vertical-align:middle;}
.fn-pagerExt{float:right;margin-top:-22px;}
.fn-pagerExt 입력{vertical-align:middle;}

/*按钮*/
.btn ,.fn-pager 입력[type='submit']{border-radius:3px;padding:1px 2px;border:1px solid #B3B3B3;cursor:pointer; background-image: 선형-그라디언트(하단으로, #fff, #e6e6e6); 상자 그림자: 0 1px 0 rgba(255, 255, 255, 0.2) 삽입, 0 1px 2px rgba(0, 0, 0, 0.05);color:#666;line-height:20px;vertical-align:middle; 텍스트 장식:없음;패딩:1px 3px ;}
a.btn{패딩:3px 6px;}
.btn:hover{배경:#eee;텍스트 장식:없음;}

.btn-on,.fn-pager 입력[type='submit']{배경-이미지:선형-그라디언트(맨 아래로,#4b8af9,#2C5193);color:#fff;border-color:rgba(0, 0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.1);배경색:#2C5193;테두리:1px 단색 #2C5193 ;}
.btn-on: hover,.fn-pager 입력[type='submit']:hover{배경:#4b8af9;color:#fff;}

.btn-gray{배경:linear-gradient(하단으로,#ccc ,#efefef);색상:#fff;테두리 색상:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.1);커서:허용되지 않음 ;}
.btn-gray:hover{배경:#eee;text-장식:없음;}

.btn:active{box-shadow:inset 0 1px 2px rgba(0,0,0 ,.25),삽입 0 1px 3px rgba(0,0,0,0.15);}

#tooltip{위치: 절대; 테두리: 1px 솔리드 #333;배경: #f7f5d1;패딩: 2px 5px ;색상: #333;디스플레이: 없음;너비: 500px;}
#tooltip{위치:절대;색상:#333;디스플레이:블록;배경 색상:#fff;테두리:1px 단색 #555;상자- 그림자:0 0 10px rgba(0,0,0,.3);border-radius:5px;padding:3px;min-width:160px;min-height:80px;}
#tooltip img{border-radius :5px;}

/*文字大小*/
.font12{font-size:12px;}
.font13{font-size:13px;}
.font14{font- 크기:14px;}
.font15{글꼴 크기:15px;}
.font16{글꼴 크기:16px;}
.font17{글꼴 크기:17px;}
.font18{ 글꼴 크기:18px;}
/*문자 글자색*/
.font-red{color:Red;}
.font-green{color:Green;}
.font-white{ 색상:흰색;}
.font-gray{색상:회색;}

/*鼠标标记*/
.hand{cursor:pointer;}


3, 主要js

jquery.js

ui.core.js

[javascript] 일반 복사 보기에서 CODE上查看代码文派生到我的代码文

/*
* jQuery UI 1.7.1
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* MIT에 따라 이중 라이선스 부여 (MIT-LICENSE.txt)
* 및 GPL(GPL-LICENSE.txt) 라이선스.
*
* http://docs.jquery.com/UI
*/
;jQuery.ui || (function($) {

var _remove = $.fn.remove,
isFF2 ​​= $.browser.mozilla && (parseFloat($.browser.version)
//도우미 기능 및 UI 개체
$.ui = {
version: "1.7.1",

// $.ui.plugin은 대신 프록시 패턴을 사용하세요.
플러그인: {
add: function(module, option, set) {
var proto = $.ui[module].prototype
for(var i in set) {
proto .plugins[i] = proto.plugins[i] ||
proto.plugins[i].push([option, set[i]])
}
},
call: function(instance, name, args) {
var set = 인스턴스.plugins[name];
if(!set || !instance.element[0].parentNode) { return; >
for (var i = 0; i if (instance.options[set[i][0]]) {
set[i][1] .apply(instance.element, args)
}
}
}
},

포함: function(a, b) {
return document.compareDocumentPosition
? a.compareDocumentPosition(b) & 16
: a !== b && a.contains(b)
},

hasScroll: function(el, a) {

//오버플로가 숨겨진 경우 요소에 추가 콘텐츠가 있을 수 있지만 사용자는 이를 숨기고 싶어합니다.
if ($(el).css('overflow') == 'hidden') { return false ; }

var scroll = (a && a == '왼쪽') ? 'scrollLeft': 'scrollTop',
has = false;

if (el[scroll] > 0) { return true; }

// TODO: 실제로 이런 일이 발생하는 경우를 결정합니다
// 요소에 스크롤 세트가 없으면
// 스크롤 설정이 가능한지 확인하세요
엘[스크롤] = 1;
has = (el[스크롤] > 0);
엘[스크롤] = 0;
반품이 완료되었습니다.
},

isOverAxis: function(x, reference, size) {
//x 좌표가 "b" 요소 축 위에 있을 때 결정
return (x > reference) && ( x },

isOver: function(y, x, top, left, height, width) {
//x, y 좌표가 "b" 요소 위에 있을 때 결정
return $ .ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
},

keyCode: {
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
Control: 17,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
INSERT: 45,
LEFT: 37,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SHIFT: 16,
SPACE: 32,
TAB: 9,
UP: 38
}
};

// WAI-ARIA 정규화
if (isFF2) {
var attr = $.attr,
removeAttr = $.fn.removeAttr,
ariaNS = "http:/ /www.w3.org/2005/07/aaa",
ariaState = /^aria-/,
ariaRole = /^wirole:/;

$.attr = 함수(요소, 이름, 값) {
var set = 값 !== 정의되지 않음;

return (name == 'role'
? (set
? attr.call(this, elem, name, "wirole:" value)
: (attr.apply(this , 인수) || "").replace(ariaRole, ""))
: (ariaState.test(name)
? (
설정? elem.setAttributeNS(ariaNS,
name.replace) (ariaState, "aaa:"), 값)
: attr.call(this, elem, name.replace(ariaState, "aaa:")))
: attr.apply(this, 인수))) ;
};

$.fn.removeAttr = function(name) {
return (ariaState.test(name)
? this.each(function() {
this.removeAttributeNS(ariaNS, name) .replace(ariaState, ""));
}) : RemoveAttr.call(this, 이름));
};
}

//jQuery 플러그인
$.fn.extend({
remove: function() {
// Safari에는 실제로 DOM 요소를 제거하는 기본 제거 이벤트가 있습니다.
// 따라서 Trigger (#3037) 대신에 TriggerHandler를 사용해야 합니다.
$("*", this).add(this).each(function() {
$(this). TriggerHandler("remove");
});
return _remove.apply(this, 인수 )
},

enableSelection: function() {
return this >.attr('unselectable', 'off')
.css('MozUserSelect', '')
.unbind('selectstart.ui')
},

disableSelection : function() {
이것을 반환
.attr('unselectable', 'on')
.css('MozUserSelect', 'none')
.bind('selectstart.ui', function() { return false });

scrollParent: function() {
var scrollParent
if(($.browser.msie && (/(static| 상대)/).test(this.css('위치'))) || (/absolute/).test(this.css('위치'))) {
scrollParent = this.parents().filter (function() {
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($ .curCSS(this,'overflow',1) $.curCSS(this,'overflow-y',1) $.curCSS(this,'overflow-x',1));
}).eq(0);
} else {
scrollParent = this.parents().filter(function() {
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1 ) $.curCSS(this,'overflow-y',1) $.curCSS(this,'overflow-x',1))
}).eq(0);
}

return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(문서) : scrollParent;
}
});


//추가 선택자
$.extend($.expr[':'], {
data: function(elem, i, match) {
return !! $.data(elem, match[3])
},

focusable: function(element) {
var nodeName = element.nodeName.toLowerCase(),
tabIndex = $ .attr(element, 'tabindex');
return (/input|select|textarea|button|object/.test(nodeName)
? !element.disabled
: 'a' == nodeName | | 'area' == nodeName
? element.href || !isNaN(tabIndex)
: !isNaN(tabIndex))
// 요소와 모든 상위 항목이 표시되어야 합니다
/ / 브라우저는 해당 영역이 숨겨져 있다고 보고할 수 있습니다
&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length
},

tabbable: function(element) {
var tabIndex = $.attr(element, 'tabindex')
return (isNaN(tabIndex) || tabIndex >= 0) && $(element ).is(':focusable');
}
});


// $.widget은 jQuery 플러그인을 생성하는 팩토리입니다.
// 플러그인 코드에서 일부 상용구 코드 가져오기
function getter(namespace, 플러그인, 메소드, args) {
function getMethods(type) {
var 메소드 = $[namespace][plugin][type] || [];
return(메소드 유형 == '문자열' ? 메소드.split(/,?s /) : 메소드);
}

var 메소드 = getMethods('getter');
if (args.length == 1 && typeof args[0] == 'string') {
methods =methods.concat(getMethods('getterSetter'));
}
return ($.inArray(메서드, 메소드) != -1);
}

$.widget = function(이름, 프로토타입) {
var 네임스페이스 = name.split(".")[0];
name = name.split(".")[1];

// 플러그인 메소드 생성
$.fn[name] = function(options) {
var isMethodCall = (typeof options == 'string'),
args = Array.prototype .slice.call(인수, 1);

// 내부 메서드 호출 방지
if (isMethodCall && options.substring(0, 1) == '_') {
이것을 반환;
}

// getter 메서드 처리
if (isMethodCall && getter(namespace, name, options, args)) {
var 인스턴스 = $.data(this[0], name );
return (인스턴스 ? 인스턴스[옵션].apply(instance, args)
: 정의되지 않음);
}

// 초기화 및 비-getter 메서드 처리
return this.each(function() {
var instance = $.data(this, name);

// 생성자
(!instance && !isMethodCall &&
$.data(this, name, new $[namespace][name](this, options))._init())

// 메소드 호출
(instance && isMethodCall && $.isFunction(instance[options]) &&
instance[options].apply(instance, args))
});
};

// 위젯 생성자 생성
$[namespace] = $[namespace] || {};
$[namespace][name] = function(element, options) {
var self = this;

this.namespace = 네임스페이스;
this.widgetName = 이름;
this.widgetEventPrefix = $[namespace][name].eventPrefix || 이름;
this.widgetBaseClass = 네임스페이스 '-' 이름;

this.options = $.extend({},
$.widget.defaults,
$[namespace][name].defaults,
$.metadata && $.metadata. get(요소)[이름],
옵션);

this.element = $(element)
.bind('setData.' name, function(event, key, value) {
if (event.target == element) {
return self._setData(key, value);
}
})
.bind('getData.' name, function(event, key) {
if (event.target == 요소 ) {
return self._getData(key);
}
})
.bind('remove', function() {
return self.destroy();
} );
};

// 위젯 프로토타입 추가
$[namespace][name].prototype = $.extend({}, $.widget.prototype, 프로토타입);

// TODO: 위젯 프로토타입
// 및 플러그인 프로토타입
$[namespace][name].getterSetter = 'option'에서 getter 및 getterSetter 속성을 병합합니다.
};

$.widget.prototype = {
_init: function() {},
destroy: function() {
this.element.removeData(this.widgetName)
. RemoveClass(this.widgetBaseClass '-disabled' ' ' this.namespace '-state-disabled')
.removeAttr('aria-disabled');
},

옵션: function(key, value) {
var options = key,
self = this;

if (키 유형 == "문자열") {
if (값 === 정의되지 않음) {
return this._getData(key);
}
옵션 = {};
옵션[키] = 값;
}

$.each(options, function(key, value) {
self._setData(key, value);
});
},
_getData: function(key) {
return this.options[key];
},
_setData: 함수(키, 값) {
this.options[key] = 값;

if (key == 'disabled') {
this.element
[value ? 'addClass': 'removeClass'](
this.widgetBaseClass '-disabled' ' '
this.namespace '-state-disabled')
.attr("aria-disabled", value);
}
},

활성화: function() {
this._setData('disabled', false);
},
disable: function() {
this._setData('disabled', true);
},

_trigger: function(type, event, data) {
var callback = this.options[type],
eventName = (type == this.widgetEventPrefix
? 유형 : this.widgetEventPrefix 유형);

이벤트 = $.이벤트(이벤트);
이벤트.유형 = 이벤트이름;

// 원래 이벤트 속성을 새 이벤트로 복사합니다.
// $.Event 대신 $.event.fix를 호출할 수 있지만
// 호출할 수 없는 경우 이런 일이 발생합니다. 이벤트를 여러 번 수정하도록 강제하는 방법
if (event.originalEvent) {
for (var i = $.event.props.length, prop; i;) {
prop = $. event.props[--i];
이벤트[prop] = 이벤트.원본이벤트[prop];
}
}

this.element.trigger(이벤트, 데이터);

return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
|| event.isDefaultPrevented());
}
};

$.widget.defaults = {
disabled: false
};


/**마우스 상호작용 플러그인 **/

$.ui.mouse = {
_mouseInit: function() {
var self = this;

this.element
.bind('mousedown.' this.widgetName, function(event) {
return self._mouseDown(event);
})
.bind( 'click.' this.widgetName, function(event) {
if(self._preventClickEvent) {
self._preventClickEvent = false;
event.stopImmediatePropagation(); }
});

// IE에서 텍스트 선택 방지
if ($.browser.msie) {
this._mouseUnselectable = this.element.attr('unselectable');
this.element.attr('unselectable', 'on');
}

this.started = false;
},

// TODO: 하나의 마우스 인스턴스를 파괴해도
// 다른 마우스 인스턴스가 손상되지 않는지 확인하세요
_mouseDestroy: function() {
this.element.unbind( '.' this.widgetName);

// IE에서 텍스트 선택 복원
($.browser.msie
&& this.element.attr('unselectable', this._mouseUnselectable));
},

_mouseDown: function(event) {
// 두 개 이상의 위젯이 mouseStart를 처리하도록 허용하지 마세요
// TODO: OriginalEvent를 사용해야 하는 이유를 알아보세요
event.originalEvent = event.originalEvent || {};
if (event.originalEvent.mouseHandled) { 반환; }

// mouseup을 놓쳤을 수 있습니다(창 밖)
(this._mouseStarted && this._mouseUp(event));

this._mouseDownEvent = 이벤트;

var self = this,
btnIsLeft = (event.which == 1),
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target). parent().add(event.target).filter(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
true를 반환합니다.
}

this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
self.mouseDelayMet = true;
}, this.options.delay);
}

if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted = (this._mouseStart(event) !== false);
if (!this._mouseStarted) {
event.preventDefault();
참을 반환합니다.
}
}

// 이러한 대리자는 컨텍스트를 유지하는 데 필요합니다.
this._mouseMoveDelegate = function(event) {
return self._mouseMove(event);
};
this._mouseUpDelegate = function(event) {
return self._mouseUp(event);
};
$(document)
.bind('mousemove.' this.widgetName, this._mouseMoveDelegate)
.bind('mouseup.' this.widgetName, this._mouseUpDelegate);

// PreventDefault()는 여기에서 텍스트 선택을 방지하는 데 사용됩니다.
// 그러나 Safari에서는 이로 인해 선택 상자를 더 이상 선택할 수 없게 됩니다
// 따라서 이 수정 사항은 다음과 같습니다. 필요
($.browser.safari || event.preventDefault());

event.originalEvent.mouseHandled = true;
참을 반환합니다.
},

_mouseMove: function(event) {
// IE mouseup 확인 - 마우스가 창 밖에 있을 때 mouseup이 발생했습니다.
if ($.browser.msie && !event.button ) {
return this._mouseUp(event);
}

if (this._mouseStarted) {
this._mouseDrag(event);
return event.preventDefault();
}

if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event) != = 거짓);
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
}

return !this._mouseStarted;
},

_mouseUp: function(event) {
$(document)
.unbind('mousemove.' this.widgetName, this._mouseMoveDelegate)
.unbind(' mouseup.' this.widgetName, this._mouseUpDelegate);

if (this._mouseStarted) {
this._mouseStarted = false;
this._preventClickEvent = (event.target == this._mouseDownEvent.target);
this._mouseStop(이벤트);
}

false를 반환합니다.
},

_mouseDistanceMet: function(event) {
return (Math.max(
Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math. abs(this._mouseDownEvent.pageY - event.pageY)
) >= this.options.distance
);
},

_mouseDelayMet: function(event) {
return this.mouseDelayMet;
},

// 이는 플러그인
_mouseStart: function(event) {},
_mouseDrag: function(event) {}, _mouseStop: 함수(이벤트) {},
_mouseCapture: 함수(이벤트) { return true; }
};

$.ui.mouse.defaults = {
취소: null,
거리: 1,
지연: 0
};

})(jQuery);


ui.sortable.js


[javascript] view plaincopy在CODE上查看代码文派生到我的代码文

/*
* jQuery UI 정렬 가능 1.7.1
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* MIT에 따라 이중 라이선스 부여됨(MIT-LICENSE.txt) )
* 및 GPL(GPL-LICENSE.txt) 라이선스.
*
* http://docs.jquery.com/UI/Sortables
*
* 종속:
* ui.core.js
*/
(함수 ($) {

$.widget("ui.sortable", $.extend({}, $.ui.mouse, {
_init: function() {

var o = this.options;
this.containerCache = {};
this.element.addClass("ui-sortable")

//항목 가져오기
this.refresh( );

//항목이 떠 있는지 확인합니다
this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css ('float')) : false;

//상위 오프셋을 결정합니다
this.offset = this.element.offset()

//상호작용을 위한 마우스 이벤트 초기화
this._mouseInit()

},

destroy: function() {
this.element
.removeClass("ui-sortable ui-sortable-disabled")
.removeData("sortable")
. unbind(".sortable");
this._mouseDestroy();

for ( var i = this.items.length - 1; i >= 0; i-- )
this.items[i].item.removeData("sortable-item");
},

_mouseCapture: function(event, overrideHandle) {

if (this.reverting) {
return false;
}

if(this.options.disabled || this.options.type == 'static') return false;

//우선 아이템 데이터를 한 번 새로 고쳐야 합니다
this._refreshItems(event);

//클릭한 노드(또는 해당 상위 항목 중 하나)가 this.items에서 실제 항목인지 확인하세요.
var currentItem = null, self = this, node = $(event.target). parent().each(function() {
if($.data(this, 'sortable-item') == self) {
currentItem = $(this);
return false;
}
});
if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);

if(!currentItem)은 false를 반환합니다.
if(this.options.handle && !overrideHandle) {
var validHandle = false;

$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
if(!validHandle)는 false를 반환합니다.
}

this.currentItem = currentItem;
this._removeCurrentsFromItems();
참을 반환합니다.

},

_mouseStart: function(event, overrideHandle, noActivation) {

var o = this.options, self = this;
this.currentContainer = this;

//refreshItems 호출이 mouseCapture
this.refreshPositions();로 이동되었으므로 RefreshPositions만 호출하면 됩니다.

//표시되는 도우미 생성 및 추가
this.helper = this._createHelper(event);

//헬퍼 크기 캐시
this._cacheHelperProportions();

/*
* - 위치 생성 -
* 이 블록은 위치와 관련된 모든 것을 생성합니다. 이는 드래그 가능의 핵심입니다.
*/

//원래 요소의 여백을 캐시합니다
this._cacheMargins();

//다음 스크롤 상위 가져오기
this.scrollParent = this.helper.scrollParent();

//페이지에서 여백을 뺀 요소의 절대 위치
this.offset = this.currentItem.offset();
this.offset = {
top: this.offset.top - this.margins.top,
left: this.offset.left - this.margins.left
};

// 오프셋을 얻은 후에만 도우미의 위치를 ​​절대 위치로 변경할 수 있습니다.
// TODO: 여전히 상대 정렬을 가능하게 하는 방법을 찾아야 합니다
this.helper.css ("위치", "절대");
this.cssPosition = this.helper.css("위치");

$.extend(this.offset, {
click: { //요소를 기준으로 클릭이 발생한 위치
left: event.pageX - this.offset.left,
top: event.pageY - this.offset.top
},
parent: this._getParentOffset(),
relative: this._getRelativeOffset() //절대 위치에서 실제 위치를 뺀 상대 위치입니다. 계산 - 상대 위치 도우미에만 사용됩니다
});

//원래 위치 생성
this.originalPosition = this._generatePosition(event);
this.originalPageX = event.pageX;
this.originalPageY = event.pageY;

//'cursorAt'가 제공된 경우 도우미를 기준으로 마우스 오프셋을 조정합니다.
if(o.cursorAt)
this._adjustOffsetFromHelper(o.cursorAt);

//이전 DOM 위치 캐시
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };

//도우미가 원본이 아닌 경우 드래그하는 동안 어떤 역할도 하지 않도록 원본을 숨기면 이 방법으로 문제가 발생하지 않습니다.
if(this.helper[0] != this.currentItem[0]) {
this.currentItem.hide();
}

//자리 표시자 만들기
this._createPlaceholder();

//옵션에 제공된 경우 포함을 설정합니다.
if(o.containment)
this._setContainment();

if(o.cursor) { // 커서 옵션
if ($('body').css("cursor")) this._storedCursor = $('body').css(" 커서");
$('body').css("cursor", o.cursor);
}

if(o.opacity) { // 불투명도 옵션
if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity" );
this.helper.css("opacity", o.opacity);
}

if(o.zIndex) { // zIndex 옵션
if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex" );
this.helper.css("zIndex", o.zIndex);
}

//스크롤 준비
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
this.overflowOffset = this.scrollParent.offset();

//콜백 호출
this._trigger("start", event, this._uiHash());

//헬퍼 크기 다시 캐시
if(!this._preserveHelperProportions)
this._cacheHelperProportions();


//가능한 컨테이너에 '활성화' 이벤트 게시
if(!noActivation) {
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("활성화", event, self._uiHash(this)); }
}

//가능한 드롭 가능 항목 준비
if($.ui.ddmanager)
$.ui.ddmanager.current = this;

if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, 이벤트);

this.draging = true;

this.helper.addClass("ui-sortable-helper");
this._mouseDrag(이벤트); //드래그를 한 번 실행합니다. 이렇게 하면 올바른 위치를 얻기 전에 도우미가 표시되지 않게 됩니다.
return true;

},

_mouseDrag: function(event) {

//헬퍼 위치 계산
this.position = this._generatePosition(event);
this.positionAbs = this._convertPositionTo("absolute");

if (!this.lastPositionAbs) {
this.lastPositionAbs = this.positionAbs;
}

//스크롤 실행
if(this.options.scroll) {
var o = this.options, scrolled = false;
if(this.scrollParent[0] != 문서 && this.scrollParent[0].tagName != 'HTML') {

if((this.overflowOffset.top this.scrollParent[0] .offsetHeight) - event.pageY this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop o.scrollSpeed;
else if(event.pageY - this.overflowOffset.top this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;

if((this.overflowOffset.left this.scrollParent[0].offsetWidth) - event.pageX this.scrollParent[0].scrollLeft = 스크롤 = this.scrollParent [0].scrollLeft o.scrollSpeed;
else if(event.pageX - this.overflowOffset.left this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;

} else {

if(event.pageY - $(document).scrollTop() scrolled = $(document).scrollTop($(document ).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) scrolled = $(document).scrollTop($(document ).scrollTop() o.scrollSpeed);

if(event.pageX - $(document).scrollLeft() scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed );
else if($(window).width() - (event.pageX - $(document).scrollLeft()) scrolled = $(document).scrollLeft($(document ).scrollLeft() o.scrollSpeed);

}

if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event);
}

//위치 확인에 사용되는 절대 위치 재생성
this.positionAbs = this._convertPositionTo("absolute");

//헬퍼 위치 설정
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position .left 'px';
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top 'px';

//재배열
for (var i = this.items.length - 1; i >= 0; i--) {

//캐시 변수 및 교차점, 계속 교차점이 없는 경우
var item = this.items[i], itemElement = item.item[0], Intersection = this._intersectsWithPointer(item);
(!intersection)이 계속되는 경우;

if(itemElement != this.currentItem[0] //자신과 교차할 수 없습니다
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] ! = itemElement //이전에 수행된 쓸모 없는 작업 없음
&& !$.ui.contains(this.placeholder[0], itemElement) //이동된 항목이 선택된 항목의 상위 항목인 경우 작업 없음
&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
) {

this.direction = 교차로 == 1 ? "아래로": "위로";

if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
this._rearrange(event, item);
} else {
break;
}

this._trigger("change", event, this._uiHash());
휴식;
}
}

//컨테이너에 이벤트 게시
this._contactContainers(event);

//droppable과 상호 연결
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);

//콜백 호출
this._trigger('sort', event, this._uiHash());

this.lastPositionAbs = this.positionAbs;
거짓을 반환합니다.

},

_mouseStop: function(event, noPropagation) {

if(!event) return;

//드롭 가능 항목을 사용하는 경우 관리자에게 드롭에 대해 알립니다.
if ($.ui.ddmanager && !this.options.dropBehaviour)
$.ui.ddmanager.drop(this , 이벤트);

if(this.options.revert) {
var self = this;
var cur = self.placeholder.offset();

self.reverting = true;

$(this.helper).animate({
왼쪽: cur.left - this.offset.parent.left - self.margins.left (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
top: cur.top - this.offset.parent.top - self.margins.top (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
},parseInt(this.options.revert, 10) || 500, function() {
self._clear(event);
});
} else {
this._clear(event, noPropagation);
}

false를 반환합니다.

},

취소: function() {

var self = this;

if(this.draging) {

this._mouseUp();

if(this.options.helper == "original")
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
else
this.currentItem.show();

//비활성화 이벤트를 컨테이너에 게시
for (var i = this.containers.length - 1; i >= 0; i--){
this.containers[i]. _trigger("비활성화", null, self._uiHash(this));
if(this.containers[i].containerCache.over) {
this.containers[i]._trigger("out", null, self._uiHash(this));
this.containers[i].containerCache.over = 0;
}
}

}

//$(this.placeholder[0]).remove(); jQuery 방식이었을 것입니다. 불행히도 원래 노드에서 모든 이벤트를 바인딩 해제합니다!
if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();

$.extend(this, {
helper: null,
draging: false,
reverting: false,
_noFinalSort: null
});

if(this.domPosition.prev) {
$(this.domPosition.prev).after(this.currentItem);
} else {
$(this.domPosition.parent).prepend(this.currentItem);
}

true를 반환합니다.

},

직렬화: function(o) {

var items = this._getItemsAsjQuery(o && o.connected);
var str = []; 오 = 오 || {};

$(items).each(function() {
var res = ($(o.item || this).attr(o.attribute || 'id') || '') .match(o.expression || (/(. )[-=_](. )/));
if(res) str.push((o.key || res[1] '[]' ) '=' (o.key && o.expression ? res[1] : res[2]))
});

return str.join('&');

},

toArray: function(o) {

var items = this._getItemsAsjQuery(o && o.connected);
var ret = []; 오 = 오 || {};

items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
반환 리트;

},

/* 다음 핵심 함수에 주의하세요 */
_intersectsWith: function(item) {

var x1 = this.positionAbs.left,
x2 = x1 this.helperProportions.width,
y1 = this.positionAbs.top,
y2 = y1 this.helperProportions.height;

var l = item.left,
r = l item.width,
t = item.top,
b = t item.height;

var dyClick = this.offset.click.top,
dxClick = this.offset.click.left;

var isOverElement = (y1 dyClick) > t && (y1 dyClick) l && (x1 dxClick)
if( this.options.tolerance == "포인터"
|| this.options.forcePointerForContainers
|| (this.options.tolerance != "포인터" && this.helperProportions[this .floating ? '너비' : '높이'] > 항목[this.floating ? '너비' : '높이'])
) {
return isOverElement;
} else {

return (l && x2 - (this.helperProportions.width / 2) && t && y2 - (this.helperProportions.height / 2)
}
},

_intersectsWithPointer: function(item) {

var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top this .offset.click.top, item.top, item.height),
isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left this.offset.click.left, item.left, item.width),
isOverElement = isOverElementHeight && isOverElementWidth,
verticalDirection = this._getDragVerticalDirection(),
horizontalDirection = this._getDragHorizontalDirection();

if (!isOverElement)
false를 반환합니다.

이거 돌려주세요.떠요 ?
( ((horizontalDirection && 수평 방향 == "오른쪽") || 수직 방향 == "아래") ? 2 : 1 )
: ( 수직 방향 && (verticalDirection == "아래" ? 2 : 1) );

},

_intersectsWithSides: function(item) {

var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top this.offset.click.top, item .top(item.height/2), item.height),
isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left this.offset.click.left, item.left(item.width/2), item.width),
verticalDirection = this._getDragVerticalDirection(),
horizontalDirection = this._getDragHorizontalDirection();

if (this.floating && horizonDirection) {
return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
} else {
return VerticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
}

},

_getDragVerticalDirection: function() {
var delta = this.positionAbs.top - this.lastPositionAbs.top;
delta != 0 && (delta > 0 ? "down" : "up")을 반환합니다.
},

_getDragHorizontalDirection: function() {
var delta = this.positionAbs.left - this.lastPositionAbs.left;
delta != 0 && (delta > 0 ? "right" : "left")를 반환합니다.
},

refresh: function(event) {
this._refreshItems(event);
this.refreshPositions();
},

_connectWith: function() {
var options = this.options;
return options.connectWith.constructor == 문자열
? [options.connectWith]
: options.connectWith;
},

_getItemsAsjQuery: function(connected) {

var self = this;
var 항목 = [];
var 쿼리 = [];
var connectWith = this._connectWith();

if(connectWith && 연결됨) {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i] );
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable');
if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) ) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]);
}
};
};
}

queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { 옵션: this.options, 항목: this .currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]);

for (var i = query.length - 1; i >= 0; i--){
queries[i][0].each(function() {
items. 푸시(이것)
});
};

$(항목) 반환;

},

_removeCurrentsFromItems: function() {

var list = this.currentItem.find(":data(sortable-item)");

for (var i=0; i
for (var j=0; j if(list[j] == this.items[i].item[0])
this.items.splice(i,1);
};

};

},

_refreshItems: function(event) {

this.items = [];
this.containers = [이것];
var 항목 = this.items;
var self = this;
var 쿼리 = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
var connectWith = this._connectWith();

if(connectWith) {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
var inst = $.data(cur[j], 'sortable');
if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) [0], 이벤트, { 항목: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
};
};
}

for (var i = 쿼리 길이 - 1; i >= 0; i--) {
var targetData = 쿼리[i][1];
var _queries = 쿼리[i][0];

for (var j=0, queryLength = _queries.length; j var item = $(_queries[j]);

item.data('sortable-item', targetData); // 대상 확인을 위한 데이터(마우스 관리자)

items.push({
item: item,
instance: targetData,
width: 0, height: 0,
left : 0, 상단: 0
});
};
};

},

refreshPositions: function(fast) {

//항목이 offsetParent 밖으로/안으로 이동하기 때문에 offsetParent의 위치가 변경됩니다
if(this.offsetParent && this.helper) {
this.offset.parent = this._getParentOffset();
}

for (var i = this.items.length - 1; i >= 0; i--){
var item = this.items[i];

//연결된 모든 컨테이너를 초과하지 않으면 연결된 모든 컨테이너의 위치 계산을 무시합니다.
if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this .currentItem[0])
계속;

var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;

if (!fast) {
item.width = t.outerWidth();
item.height = t.outerHeight();
}

var p = t.offset();
item.left = p.left;
item.top = p.top;
};

if(this.options.custom && this.options.custom.refreshContainers) {
this.options.custom.refreshContainers.call(this);
} else {
for (var i = this.containers.length - 1; i >= 0; i--){
var p = this.containers[i].element.offset( );
this.containers[i].containerCache.left = p.left;
this.containers[i].containerCache.top = p.top;
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
};
}

},

_createPlaceholder: function(that) {

var self = that || 이것, o = self.options;

if(!o.placeholder || o.placeholder.constructor == String) {
var className = o.placeholder;
o.placeholder = {
요소: function() {

var el = $(document.createElement(self.currentItem[0].nodeName))
.addClass(className | | self.currentItem[0].className " ui-sortable-placeholder")
.removeClass("ui-sortable-helper")[0];

if(!className)
el.style.visibility = "숨김";

엘을 반환;
},
update: function(container, p) {

// 1. className이 'placeholder 옵션으로 설정된 경우 크기를 강제하지 않습니다. 클래스가 이에 대한 책임을 집니다.
// 2. 'forcePlaceholderSize' 옵션을 활성화하면 클래스 이름이 지정되어 있어도 강제로 적용할 수 있습니다.
if(className && !o.forcePlaceholderSize) return;

//요소가 자체적으로 실제 높이를 갖지 않는 경우(스타일시트에서 오는 스타일 없이) 드래그된 항목에서 인라인 높이를 받습니다.
if(!p.height()) { p.height(self.currentItem.innerHeight() -parseInt(self.currentItem.css('paddingTop')||0, 10) -parseInt(self.currentItem.css('paddingBottom')||0, 10) ); };
if(!p.width()) { p.width(self.currentItem.innerWidth() -parseInt(self.currentItem.css('paddingLeft')||0, 10) -parseInt(self.currentItem. css('paddingRight')||0, 10)); };
}
};
}

//자리 표시자 만들기
self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));

//실제 현재 항목 뒤에 추가하세요.
self.currentItem.after(self.placeholder);

//자리 표시자 크기 업데이트(TODO: 논리를 퍼지로, 316/317행 참조)
o.placeholder.update(self, self.placeholder);

},

_contactContainers: function(event) {
for (var i = this.containers.length - 1; i >= 0; i--){

if(this._intersectsWith(this.containers[i].containerCache)) {
if(!this.containers[i].containerCache.over) {

if(this.currentContainer != this.containers[i]) {

//새 컨테이너에 들어갈 때 거리가 가장 짧은 항목을 찾아서 그 근처에 항목을 추가합니다.
var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[i].floating ? '왼쪽' : '위쪽'];
for (var j = this.items.length - 1; j >= 0; j--) {
if(!$.ui.contains(this.containers[i].element[0] , this.items[j].item[0])) 계속;
var cur = this.items[j][this.containers[i].floating ? '왼쪽' : '위쪽'];
if(Math.abs(cur - base) dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
}
}

if(!itemWithLeastDistance && !this.opt

value="保存顺序" />

提示:按住鼠标拖动链接,之后单击保存按钮就可以完成对链接的排列




성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
使用Python实现XML数据的筛选和排序使用Python实现XML数据的筛选和排序Aug 07, 2023 pm 04:17 PM

使用Python实现XML数据的筛选和排序引言:XML是一种常用的数据交换格式,它以标签和属性的形式存储数据。在处理XML数据时,我们经常需要对数据进行筛选和排序。Python提供了许多有用的工具和库来处理XML数据,本文将介绍如何使用Python实现XML数据的筛选和排序。读取XML文件在开始之前,我们需要先读取XML文件。Python有许多XML处理库,

C++程序:按字母顺序重新排列单词的位置C++程序:按字母顺序重新排列单词的位置Sep 01, 2023 pm 11:37 PM

在这个问题中,一个字符串被作为输入,我们必须按字典顺序对字符串中出现的单词进行排序。为此,我们为字符串中的每个单词(之间用空格区分)分配一个从1开始的索引,并以排序索引的形式获得输出。String={“Hello”,“World”}“Hello”=1“World”=2由于输入字符串中的单词已按字典顺序排列,因此输出将打印为“12”。让我们看看一些输入/结果场景-假设输入字符串中的所有单词都相同,让我们看看结果-Input:{“hello”,“hello”,“hello”}Result:3获得的结

如何优化Java集合排序性能如何优化Java集合排序性能Jun 30, 2023 am 10:43 AM

Java是一种功能强大的编程语言,广泛应用于各类软件开发中。在Java开发中,经常会涉及到对集合进行排序的场景。然而,如果不对集合排序进行性能优化,可能会导致程序的执行效率下降。本文将探讨如何优化Java集合排序的性能。一、选择合适的集合类在Java中,有多种集合类可以用来进行排序,如ArrayList、LinkedList、TreeSet等。不同的集合类在

如何利用vue和Element-plus实现数据的分组和排序如何利用vue和Element-plus实现数据的分组和排序Jul 18, 2023 am 10:39 AM

如何利用Vue和ElementPlus实现数据的分组和排序Vue是一种流行的JavaScript框架,它可以帮助我们构建前端应用程序。ElementPlus是基于Vue的桌面端组件库,它提供了丰富的UI组件,使我们能够轻松地构建出漂亮且用户友好的界面。在本文中,我们将探讨如何利用Vue和ElementPlus来实现数据的分组和排序。首先,我们需要准备一

Java开发中如何优化集合排序去重性能Java开发中如何优化集合排序去重性能Jul 02, 2023 am 11:25 AM

Java开发中,集合排序和去重是常见的需求。然而,在处理大数据集合时,性能往往会成为一个问题。本文将介绍一些优化技巧,帮助提升集合排序和去重的性能。一、使用合适的数据结构在Java中,最常用的数据结构是ArrayList和HashSet。ArrayList适用于需要保持元素顺序的情况,而HashSet则适用于需要去重的情况。在排序和去重的场景中,我们可以使用

Java实现的常见排序算法详解Java实现的常见排序算法详解Jun 18, 2023 am 10:48 AM

排序算法是计算机科学中的一个重要概念,是许多应用程序的核心部分。在日常生活和工作中,我们经常需要对数据进行排序,例如排列名单、对数值进行排序等。Java作为一种广泛使用的编程语言,提供了许多内置的排序算法。本文将详细介绍Java中实现的常见排序算法。1.冒泡排序(BubbleSort)冒泡排序是最简单但最慢的排序算法之一。它遍历整个数组,比较相邻的元素并一

如何在Java 14中使用Records类来实现自动比较和排序如何在Java 14中使用Records类来实现自动比较和排序Jul 30, 2023 pm 01:06 PM

如何在Java14中使用Records类来实现自动比较和排序Java14引入了一种新的类称为Records类,它为我们提供了一种简洁而强大的方式来定义不可变的数据类。Records类具有自动为每个字段生成getter方法、equals()方法和hashCode()方法的特性,这使得比较和排序非常方便。在这篇文章中,我们将通过示例代码来演示如何在Java

PHP usort() 函数使用指南:排序数组PHP usort() 函数使用指南:排序数组Jun 27, 2023 pm 02:27 PM

PHPusort()函数使用指南:排序数组在PHP编程中,我们经常需要对数组进行排序。PHP提供了很多函数用于数组的排序,其中usort()函数可以灵活的对数组进行自定义排序。本文将介绍usort()函数的使用方法和注意事项,并通过实例演示如何使用usort()函数对数组进行排序。一、usort()函数简介PHPusort()函数

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

Atom Editor Mac 버전 다운로드

Atom Editor Mac 버전 다운로드

가장 인기 있는 오픈 소스 편집기

Dreamweaver Mac版

Dreamweaver Mac版

시각적 웹 개발 도구

VSCode Windows 64비트 다운로드

VSCode Windows 64비트 다운로드

Microsoft에서 출시한 강력한 무료 IDE 편집기

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음