js实现一个列表,首列和尾列固定不变,中间列可以js拖动滚动条事件查看

Database Error
A Database Error Occurred
Unable to connect to your database server using the provided settings.Filename: core/Loader.phpLine Number: 338温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
阅读(2773)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'GridView固定表头,首列(JS+CSS)推荐',
blogAbstract:'一般给GridView固定表头和首列,都是利用&CSS的expression方法来执行JS语句,但expression&只支持IE,而且IE8将不支持此方法,加之expression的&计算量很大,尤其数据量很大的时候拉动滚动条会感觉非常卡,&所以效果不很理想。&网上找到一个不错的解决方案:&
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}下面是自己写的一个js注册拖动对象的函数,不是很完善,因为接触了jquery.draggable插件后,觉得再发明轮子有点多余,所以将自己写的在项目中删了,放在这做个留念。
* 注册DOM对象的拖动事件
* @param param {
* @param target: 被注册的DOM对象,
* @param interval: 响应mouseMoveCallback回调的最小时间间隔。默认为200ms
* @param mouseDownCallback: 鼠标按下事件的回调函数。
* @param mouseMoveCallback: 拖动过程中鼠标移动事件的回调函数(本函数结合时间间隔interval使用,每隔interval时间长度才响应一次),
* @param mouseUpCallback: 拖动完成的回调函数。
* @param canXMove: X轴方向是否可以移动。true-可以移动;false-不可以移动。默认值true
* @param canYMove: Y轴方向是否可以移动。true-可以移动;false-不可以移动。默认值true
* @param xRange: Array,X轴方向的范围。xRange[0]-X轴的最小值;xRange[1]-X轴的最大值。如果xRange[0]或xRange[1]未定义,则不限制
* @param yRange: Array,Y周方向的范围。yRange[0]-Y轴的最小值;yRange[1]-Y轴的最大值。如果yRange[0]或yRange[1]未定义,则不限制
* @param delayedInterval: [INT]延迟响应拖拽的时间间隔(毫秒)。(比如想在按下鼠标之后再过100ms,如果此时还未松开鼠标,则响应拖动)
* @param useShadow: true-使用影子表示拖动效果,被拖动的原对象在鼠标移动过程中不动,直到松开鼠标后将原对象移动到鼠标位置处;false(默认)-在移动鼠标的过程中直接拖动原对象
registerDrag : function(param) {
var mindMap =
if (param==null || param.target==null) {
showMessageBox(_lang(&mindmap.message.drag.regist.error.targetnull&));
var defParam = {
canXMove: true,
canYMove: true,
interval: 200,
useShadow: false
var exParam = $.extend(defParam, param);
param.target.data(&settings&, exParam);
param.target.mousedown(function(dragPos) {
var targetObj =
//定义注册拖拽事件的初始化信息
function doRespondMouseDown() {
var dragTarget = $(targetObj);
//如果使用影子拖动效果,则克隆当前拖动对象
var moveTarget = dragT
if (exParam.useShadow) {
moveTarget = $(&&div class='mindmap_move_shadow'&&/div&&);
moveTarget.css({
width: dragTarget.width() + &px&,
height: dragTarget.height() + &px&,
left: dragTarget.css(&left&),
top: dragTarget.css(&top&)
mindMap.container.append(moveTarget);
$(targetObj).data({
clientX : dragPos.clientX,
clientY : dragPos.clientY,
actionTime : (new Date()).getTime(), //记录本次的时间戳
moveTarget : moveTarget
//保存移动的对象信息
window.dragTarget = $(targetObj);
//执行鼠标按下事件的回调函数
if (exParam.mouseDownCallback!=undefined && typeof exParam.mouseDownCallback==&function&) {
exParam.mouseDownCallback();
//如果设置了延迟响应拖拽,则设置在延迟时间后再执行拖拽初始化动作
if (exParam.delayedInterval!=undefined && parseInt(exParam.delayedInterval)!='NaN') {
window.dragDelayTimer = setTimeout(doRespondMouseDown, exParam.delayedInterval);
doRespondMouseDown();
//判断是否已经初始化拖动相关的组件
if (!window.isDragComponentInitialized) {
window.isDragComponentInitialized =
$(window).mousemove(function(dragPos) {
//如果已经有拖动对象(唯一的)
if (window.dragTarget) {
var target = window.dragT
var moveTarget = target.data(&moveTarget&);
var settings = target.data(&settings&);
var offsetX = settings.canXMove ? (dragPos.clientX - target.data(&clientX&)) : 0, //X轴移动量
offsetY = settings.canYMove ? (dragPos.clientY - target.data(&clientY&)) : 0; //y轴移动量
var lastLeft = parseFloat(moveTarget.css(&left&)); //移动前的X轴坐标
var lastTop = parseFloat(moveTarget.css(&top&)); //移动前的Y轴坐标
var movedLeft = lastLeft + offsetX;
//移动后的X轴坐标
var movedTop = lastTop + offsetY;
//移动后的Y轴坐标
//判断是否超出移动范围。如果超出移动范围,则不动
var xRange1 = (settings.xRange && settings.xRange.length&0) ? settings.xRange[0] : movedL
var xRange2 = (settings.xRange && settings.xRange.length&1) ? settings.xRange[1] : movedL
var yRange1 = (settings.yRange && settings.yRange.length&0) ? settings.yRange[0] : movedT
var yRange2 = (settings.yRange && settings.yRange.length&1) ? settings.yRange[1] : movedT
//打印debug信息
mindMap.debug([&Move Des Pos: (& + movedLeft + &,& + movedTop + &)&,
&Move Range: xRange[& + xRange1 + &~& + xRange2 + &], yRange[& + yRange1 + &~& + yRange2 + &]&]);
//如果未超出范围,则移动目标对象,并记录当前的鼠标坐标
if (movedLeft&=xRange1 && movedLeft&=xRange2 && movedTop&=yRange1 && movedTop&=yRange2) {
moveTarget.css({
left: movedLeft,
top: movedTop
target.data({
clientX: dragPos.clientX,
clientY: dragPos.clientY
if (settings.mouseMoveCallback!=null && typeof settings.mouseMoveCallback == &function&) {
var now = (new Date()).getTime();
var lastActionTime = target.data(&actionTime&);
//上一次动作执行时间
//如果是已经过了最小间隔时间段,则响应鼠标移动回调函数
mindMap.debug([&lastActionTime:& + lastActionTime + (lastActionTime==null)], true);
if (lastActionTime==null || (now - lastActionTime & settings.interval)) {
settings.mouseMoveCallback({left:movedLeft, top:movedTop});
$(window).mouseup(function(dragPos) {
//此处为处理在还未过拖拽响应延迟时间间隔之前就松开了鼠标的情况(这种情况直接取消拖拽注册即可)
if (window.dragDelayTimer) {
clearTimeout(window.dragDelayTimer);
window.dragDelayTimer =
if (window.dragTarget) {
var target = window.dragT
var settings = target.data(&settings&);
if (settings.mouseUpCallback && typeof settings.mouseUpCallback == &function&) {
settings.mouseUpCallback();
//如果是使用的影子拖动效果,则需要删除影子对象
if (settings.useShadow) {
var moveTarget = target.data(&moveTarget&);
if (moveTarget != null) {
target.css({
left: moveTarget.css(&left&),
top: moveTarget.css(&top&)
moveTarget.remove();
window.dragTarget =
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:24052次
排名:千里之外
原创:25篇
转载:19篇
(1)(3)(11)(3)(1)(2)(9)(3)(3)(5)(3)又一个jQuery提示窗插件(可拖动) 展示 weebox.js源代码
- 下载整个 - 类型:.js文件
&* weebox.js
&* weebox js
&* @category & javascript
&* @package & &jquery
&* @author & & Jack &&
&* @copyright &Copyright (c) wee Com. ()
&* @license & &/license/
&* @version & &
(function($) {
& & & & /*if(typeof($.fn.bgIframe) == 'undefined') {
& & & & & & & & $.ajax({
& & & & & & & & & & & & type: &GET&,
& & & & & & & & & & & & url: '/js/jquery/bgiframe.js',//路径不好处理
& & & & & & & & & & & & success: function(js){eval(js);},
& & & & & & & & & & & & async: false& & & & & & & & & & & & & & & & & &
& & & & & & & & });
& & & & }*/
& & & & var weebox = function(content, options) {
& & & & & & & & var self = this;
& & & & & & & & this._dragging = false;
& & & & & & & & this._content = content;
& & & & & & & & this._options = options;
& & & & & & & & this.dh = null;
& & & & & & & & this.mh = null;
& & & & & & & & this.dt = null;
& & & & & & & & this.dc = null;
& & & & & & & & this.bo = null;
& & & & & & & & this.bc = null;
& & & & & & & & this.selector = null; &
& & & & & & & & this.ajaxurl = null;
& & & & & & & & this.options = null;
& & & & & & & & this.defaults = {
& & & & & & & & & & & & boxid: null,
& & & & & & & & & & & & boxclass: null,
& & & & & & & & & & & & type: 'dialog',
& & & & & & & & & & & & title: '',
& & & & & & & & & & & & width: 0,
& & & & & & & & & & & & height: 0,
& & & & & & & & & & & & timeout: 0,
& & & & & & & & & & & & draggable: true,
& & & & & & & & & & & & modal: true,
& & & & & & & & & & & & focus: null,
& & & & & & & & & & & & position: 'center',
& & & & & & & & & & & & overlay: 75,
& & & & & & & & & & & & showTitle: true,
& & & & & & & & & & & & showButton: true,
& & & & & & & & & & & & showCancel: true,
& & & & & & & & & & & & showOk: true,
& & & & & & & & & & & & okBtnName: '确定',
& & & & & & & & & & & & cancelBtnName: '取消',
& & & & & & & & & & & & contentType: 'text',
& & & & & & & & & & & & contentChange: false,
& & & & & & & & & & & & clickClose: false,
& & & & & & & & & & & & zIndex: 999,
& & & & & & & & & & & & animate: false,
& & & & & & & & & & & & trigger: null,
& & & & & & & & & & & & onclose: null,
& & & & & & & & & & & & onopen: null,
& & & & & & & & & & & & onok: null& & & & & & &
& & & & & & & & };
& & & & & & & & this.types = new Array(
& & & & & & & & & & & & &dialog&,
& & & & & & & & & & & & &error&,
& & & & & & & & & & & & &warning&,
& & & & & & & & & & & & &success&,
& & & & & & & & & & & & &prompt&,
& & & & & & & & & & & & &box&
& & & & & & & & );
& & & & & & & & this.titles = {
& & & & & & & & & & & & &error&: & & & &&!! Error !!&,
& & & & & & & & & & & & &warning&: & & &&Warning!&,
& & & & & & & & & & & & &success&: & & &&Success&,
& & & & & & & & & & & & &prompt&: & & & &Please Choose&,
& & & & & & & & & & & & &dialog&: & & & &Dialog&,
& & & & & & & & & & & & &box&:& & & & & &&
& & & & & & & & };
& & & & & & & &
& & & & & & & & this.initOptions = function() {
& & & & & & & & & & & & if (typeof(self._options) == &undefined&) {
& & & & & & & & & & & & & & & & self._options = {};
& & & & & & & & & & & & }
& & & & & & & & & & & & if (typeof(self._options.type) == &undefined&) {
& & & & & & & & & & & & & & & & self._options.type = 'dialog';
& & & & & & & & & & & & }
& & & & & & & & & & & & if(!$.inArray(self._options.type, self.types)) {
& & & & & & & & & & & & & & & & self._options.type = self.types[0];
& & & & & & & & & & & & }
& & & & & & & & & & & & if (typeof(self._options.boxclass) == &undefined&) {
& & & & & & & & & & & & & & & & self._options.boxclass = self._options.type+&box&;
& & & & & & & & & & & & }
& & & & & & & & & & & & if (typeof(self._options.title) == &undefined&) {
& & & & & & & & & & & & & & & & self._options.title = self.titles[self._options.type];
& & & & & & & & & & & & }
& & & & & & & & & & & & if (content.substr(0, 1) == &#&) {
& & & & & & & & & & & & & & & & self._options.contentType = 'selector';
& & & & & & & & & & & & & & & & self.selector = content;
& & & & & & & & & & & & }
& & & & & & & & & & & & self.options = $.extend({}, self.defaults, self._options);
& & & & & & & & };
& & & & & & & &
& & & & & & & & this.initBox = function() {
& & & & & & & & & & & & var html = '';&
& & & & & & & & & & & & if (self.options.type == 'wee') {
& & & & & & & & & & & & & & & & html = &'&div class=&weedialog&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &div class=&dialog-header&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-tl&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-title&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-tr&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & &div class=&dialog-close& title=&关闭&&&a href=&#&&&/a&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &div class=&dialog-con&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-con2&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & &div class=&dialog-content&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & &div class=&dialog-button&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & & & & & &input type=&button& class=&dialog-ok& value=&确认& /&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & & & & & &input type=&button& class=&dialog-cancel& value=&取消& /&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & & & & & &/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &/div&' + & & &
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &div class=&dialog-bot&&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-bl&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-bc&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & & & & & &div class=&dialog-br&&&/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & ' & & & &/div&' +
& & & & & & & & & & & & & & & & & & & & & & & & '&/div&';
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & html = &&div class='dialog-box'&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div class='dialog-header'&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div class='dialog-title'&&/div&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div class='dialog-close'&&/div&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&/div&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div class='dialog-content'&&/div&& +&
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div style='clear:both'&&/div&& +& & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&div class='dialog-button'&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &&input type='button' class='dialog-ok' value='确定'&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &&input type='button' class='dialog-cancel' value='取消'&& +
& & & & & & & & & & & & & & & & & & & & & & & & & & & & &&/div&& +
& & & & & & & & & & & & & & & & & & & & & & & & &&/div&&;
& & & & & & & & & & & & }
& & & & & & & & & & & & self.dh = $(html).appendTo('body').hide().css({
& & & & & & & & & & & & & & & & position: 'absolute', &
& & & & & & & & & & & & & & & & overflow: 'hidden',
& & & & & & & & & & & & & & & & zIndex: self.options.zIndex
& & & & & & & & & & & & }); & &
& & & & & & & & & & & & self.dt = self.dh.find('.dialog-title');
& & & & & & & & & & & & self.dc = self.dh.find('.dialog-content');
& & & & & & & & & & & & self.bo = self.dh.find('.dialog-ok');
& & & & & & & & & & & & self.bc = self.dh.find('.dialog-cancel');
& & & & & & & & & & & & if (self.options.boxid) {
& & & & & & & & & & & & & & & & self.dh.attr('id', self.options.boxid);
& & & & & & & & & & & & } & & &
& & & & & & & & & & & & if (self.options.boxclass) {
& & & & & & & & & & & & & & & & self.dh.addClass(self.options.boxclass);
& & & & & & & & & & & & }
& & & & & & & & & & & & if (self.options.height&0) {
& & & & & & & & & & & & & & & & self.dc.css('height', self.options.height);
& & & & & & & & & & & & }
& & & & & & & & & & & & if (self.options.width&0) {
& & & & & & & & & & & & & & & & self.dh.css('width', self.options.width);
& & & & & & & & & & & & }
& & & & & & & & & & & & self.dh.bgiframe(); & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.initMask = function() {& & & & & & & & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & if (self.options.modal) {
& & & & & & & & & & & & & & & & self.mh = $(&&div class='dialog-mask'&&/div&&)
& & & & & & & & & & & & & & & & .appendTo('body').hide().css({
& & & & & & & & & & & & & & & & & & & & opacity: self.options.overlay/100,
& & & & & & & & & & & & & & & & & & & & filter: 'alpha(opacity='+self.options.overlay+')',
& & & & & & & & & & & & & & & & & & & & width: self.bwidth(),
& & & & & & & & & & & & & & & & & & & & height: self.bheight(),
& & & & & & & & & & & & & & & & & & & & zIndex: self.options.zIndex-1
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.initContent = function(content) {
& & & & & & & & & & & & self.dh.find(&.dialog-ok&).val(self.options.okBtnName);
& & & & & & & & & & & & self.dh.find(&.dialog-cancel&).val(self.options.cancelBtnName);
& & & & & & & & & & & & self.dh.find('.dialog-title').html(self.options.title);
& & & & & & & & & & & & if (!self.options.showTitle) {
& & & & & & & & & & & & & & & & self.dh.find('.dialog-header').hide();
& & & & & & & & & & & & } & & &
& & & & & & & & & & & & if (!self.options.showButton) {
& & & & & & & & & & & & & & & & self.dh.find('.dialog-button').hide();
& & & & & & & & & & & & }
& & & & & & & & & & & & if (!self.options.showCancel) {
& & & & & & & & & & & & & & & & self.dh.find('.dialog-cancel').hide();
& & & & & & & & & & & & } & & & & & & & & & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & if (!self.options.showOk) {
& & & & & & & & & & & & & & & & self.dh.find(&.dialog-ok&).hide();
& & & & & & & & & & & & } & & & & & & & & & & &
& & & & & & & & & & & & if (self.options.contentType == &selector&) {
& & & & & & & & & & & & & & & & self.selector = self._content;
& & & & & & & & & & & & & & & & self._content = $(self.selector).html();
& & & & & & & & & & & & & & & & self.setContent(self._content);
& & & & & & & & & & & & & & & & //if have checkbox do
& & & & & & & & & & & & & & & & var cs = $(self.selector).find(':checkbox');
& & & & & & & & & & & & & & & & self.dh.find('.dialog-content').find(':checkbox').each(function(i){
& & & & & & & & & & & & & & & & & & & & this.checked = cs[i].checked;
& & & & & & & & & & & & & & & & }); & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & $(self.selector).empty();
& & & & & & & & & & & & & & & & self.onopen();
& & & & & & & & & & & & & & & & self.show();
& & & & & & & & & & & & & & & & self.focus();
& & & & & & & & & & & & } else if (self.options.contentType == &ajax&) {& & & &
& & & & & & & & & & & & & & & & self.ajaxurl = self._content; & & & & & & & & &
& & & & & & & & & & & & & & & & self.setContent('&div class=&dialog-loading&&&/div&');& & & & & & & & & & & & &
& & & & & & & & & & & & & & & & self.show();
& & & & & & & & & & & & & & & & $.get(self.ajaxurl, function(data) {
& & & & & & & & & & & & & & & & & & & & self._content = data;
& & & & & & & & & & & & & & & & self.setContent(self._content);
& & & & & & & & & & & & & & & & self.onopen();
& & & & & & & & & & & & & & & & self.focus(); & & & & & & & & &
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & self.setContent(self._content);
& & & & & & & & & & & & & & & & self.onopen();&
& & & & & & & & & & & & & & & & self.show();& &
& & & & & & & & & & & & & & & & self.focus(); & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.initEvent = function() {
& & & & & & & & & & & & self.dh.find(&.dialog-close, .dialog-cancel, .dialog-ok&).unbind('click').click(function(){self.close();}); & & & & & & & & & &
& & & & & & & & & & & & if (typeof(self.options.onok) == &function&) {
& & & & & & & & & & & & & & & & self.dh.find(&.dialog-ok&).unbind('click').click(self.options.onok);
& & & & & & & & & & & & }
& & & & & & & & & & & & if (typeof(self.options.oncancel) == &function&) {
& & & & & & & & & & & & & & & & self.dh.find(&.dialog-cancel&).unbind('click').click(self.options.oncancel);
& & & & & & & & & & & & } & & & & & & & & & & &
& & & & & & & & & & & & if (self.options.timeout&0) {
& & & & & & & & & & & & & & & & window.setTimeout(self.close, (self.options.timeout * 1000));
& & & & & & & & & & & & } & & &
& & & & & & & & & & & & this.draggable(); & & & & & & & & & & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.draggable = function() { & & & & &
& & & & & & & & & & & & if (self.options.draggable && self.options.showTitle) {
& & & & & & & & & & & & & & & & self.dh.find('.dialog-header').mousedown(function(event){
& & & & & & & & & & & & & & & & & & & & self._ox = self.dh.position().left;
& & & & & & & & & & & & & & & & & & & & self._oy = self.dh.position().top;& & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & & & & & self._mx = event.clientX;
& & & & & & & & & & & & & & & & & & & & self._my = event.clientY;
& & & & & & & & & & & & & & & & & & & & self._dragging = true;
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & & & & & var handle = self.mh;
& & & & & & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & & & & & var handle = $(document);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & $(document).mousemove(function(event){
& & & & & & & & & & & & & & & & & & & & if (self._dragging == true) {
& & & & & & & & & & & & & & & & & & & & & & & & //window.status = &X:&+event.clientX+&Y:&+event.clientY;
& & & & & & & & & & & & & & & & & & & & & & & & self.dh.css({
& & & & & & & & & & & & & & & & & & & & & & & & & & & & left: self._ox+event.clientX-self._mx,
& & & & & & & & & & & & & & & & & & & & & & & & & & & & top: self._oy+event.clientY-self._my
& & & & & & & & & & & & & & & & & & & & & & & & });
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & }).mouseup(function(){
& & & & & & & & & & & & & & & & & & & & self._mx = null;
& & & & & & & & & & & & & & & & & & & & self._my = null;
& & & & & & & & & & & & & & & & & & & & self._dragging = false;
& & & & & & & & & & & & & & & & });
& & & & & & & & & & & & & & & & var e = self.dh.find('.dialog-header').get(0);
& & & & & & & & & & & & & & & & e.unselectable = &on&;
& & & & & & & & & & & & & & & & e.onselectstart = function() {
& & & & & & & & & & & & & & & & & & & & return false;
& & & & & & & & & & & & & & & & };
& & & & & & & & & & & & & & & & if (e.style) {
& & & & & & & & & & & & & & & & & & & & e.style.MozUserSelect = &none&;
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } & & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.onopen = function() {& & & & & & & & & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & if (typeof(self.options.onopen) == &function&) {
& & & & & & & & & & & & & & & & self.options.onopen();
& & & & & & & & & & & & } & & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.show = function() {& & & &
& & & & & & & & & & & & if (self.options.position == 'center') {
& & & & & & & & & & & & & & & & self.setCenterPosition();
& & & & & & & & & & & & }
& & & & & & & & & & & & if (self.options.position == 'element') {
& & & & & & & & & & & & & & & & self.setElementPosition();
& & & & & & & & & & & & } & & & & & & &
& & & & & & & & & & & & if (self.options.animate) { & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & self.dh.fadeIn(&slow&);
& & & & & & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & & & & & self.mh.fadeIn(&normal&);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & self.dh.show();
& & & & & & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & & & & & self.mh.show();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } & & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.focus = function() {
& & & & & & & & & & & & if (self.options.focus) {
& & & & & & & & & & & & & & & & self.dh.find(self.options.focus).focus();
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & self.dh.find('.dialog-cancel').focus();
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.find = function(selector) {
& & & & & & & & & & & & return self.dh.find(selector);
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.setTitle = function(title) {
& & & & & & & & & & & & self.dh.find('.dialog-title').html(title);
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.getTitle = function() {
& & & & & & & & & & & & return self.dh.find('.dialog-title').html();
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.setContent = function(content) {
& & & & & & & & & & & & self.dh.find('.dialog-content').html(content);
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.getContent = function() {
& & & & & & & & & & & & return self.dh.find('.dialog-content').html();
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.hideButton = function(btname) {
& & & & & & & & & & & & self.dh.find('.dialog-'+btname).hide(); & & & & & & & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.showButton = function(btname) {
& & & & & & & & & & & & self.dh.find('.dialog-'+btname).show();
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.setButtonTitle = function(btname, title) {
& & & & & & & & & & & & self.dh.find('.dialog-'+btname).val(title); & &
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.close = function() {
& & & & & & & & & & & & if (self.animate) {
& & & & & & & & & & & & & & & & self.dh.fadeOut(&slow&, function () { self.dh.hide(); });
& & & & & & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & & & & & self.mh.fadeOut(&normal&, function () { self.mh.hide(); });
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & self.dh.hide();
& & & & & & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & & & & & self.mh.hide();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & & & & & if (self.options.contentType == 'selector') {
& & & & & & & & & & & & & & & & if (self.options.contentChange) {
& & & & & & & & & & & & & & & & & & & & //if have checkbox do
& & & & & & & & & & & & & & & & & & & & var cs = self.find(':checkbox');
& & & & & & & & & & & & & & & & & & & & $(self.selector).html(self.getContent()); & & & & & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & & & & & if (cs.length & 0) {
& & & & & & & & & & & & & & & & & & & & & & & & $(self.selector).find(':checkbox').each(function(i){
& & & & & & & & & & & & & & & & & & & & & & & & & & & & this.checked = cs[i].checked;
& & & & & & & & & & & & & & & & & & & & & & & & });
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & & & & & $(self.selector).html(self._content);
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } & & & & & & & & & & & & & & & & & & & & & & & & & & & & & & &
& & & & & & & & & & & & if (typeof(self.options.onclose) == &function&) {
& & & & & & & & & & & & & & & & self.options.onclose();
& & & & & & & & & & & & }
& & & & & & & & & & & & self.dh.remove();
& & & & & & & & & & & & if (self.mh) {
& & & & & & & & & & & & & & & & self.mh.remove();
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.bheight = function() {
& & & & & & & & & & & & if ($.browser.msie && $.browser.version & 7) {
& & & & & & & & & & & & & & & & var scrollHeight = Math.max(
& & & & & & & & & & & & & & & & & & & & document.documentElement.scrollHeight,
& & & & & & & & & & & & & & & & & & & & document.body.scrollHeight
& & & & & & & & & & & & & & & & );
& & & & & & & & & & & & & & & & var offsetHeight = Math.max(
& & & & & & & & & & & & & & & & & & & & document.documentElement.offsetHeight,
& & & & & & & & & & & & & & & & & & & & document.body.offsetHeight
& & & & & & & & & & & & & & & & );
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & if (scrollHeight & offsetHeight) {
& & & & & & & & & & & & & & & & & & & & return $(window).height();
& & & & & & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & & & & & return scrollHeight;
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & return $(document).height();
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.bwidth = function() {
& & & & & & & & & & & & if ($.browser.msie && $.browser.version & 7) {
& & & & & & & & & & & & & & & & var scrollWidth = Math.max(
& & & & & & & & & & & & & & & & & & & & document.documentElement.scrollWidth,
& & & & & & & & & & & & & & & & & & & & document.body.scrollWidth
& & & & & & & & & & & & & & & & );
& & & & & & & & & & & & & & & & var offsetWidth = Math.max(
& & & & & & & & & & & & & & & & & & & & document.documentElement.offsetWidth,
& & & & & & & & & & & & & & & & & & & & document.body.offsetWidth
& & & & & & & & & & & & & & & & );
& & & & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & if (scrollWidth & offsetWidth) {
& & & & & & & & & & & & & & & & & & & & return $(window).width();
& & & & & & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & & & & & return scrollWidth;
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & return $(document).width();
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.setCenterPosition = function() {
& & & & & & & & & & & & var wnd = $(window), doc = $(document),
& & & & & & & & & & & & & & & & pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
& & & & & & & & & & & & & & & & minTop = pTop;&
& & & & & & & & & & & & pTop += (wnd.height() - self.dh.height()) / 2;
& & & & & & & & & & & & pTop = Math.max(pTop, minTop);
& & & & & & & & & & & & pLeft += (wnd.width() - self.dh.width()) / 2;
& & & & & & & & & & & & self.dh.css({top: pTop, left: pLeft});
& & & & & & & & }
& & & & & & & &
& & & & & & & & this.setElementPosition = function() {
& & & & & & & & & & & & var trigger = $(&#&+self.options.trigger);& & & & & & & & & & &
& & & & & & & & & & & & if (trigger.length == 0) {
& & & & & & & & & & & & & & & & alert('请设置位置的相对元素');
& & & & & & & & & & & & & & & & self.close(); & & & & & & & & & & & & &
& & & & & & & & & & & & & & & & return false;
& & & & & & & & & & & & } & & & & & & &
& & & & & & & & & & & & var scrollWidth = 0;
& & & & & & & & & & & & if (!$.browser.msie || $.browser.version &= 7) {
& & & & & & & & & & & & & & & & scrollWidth = $(window).width() - document.body.scrollWidth;
& & & & & & & & & & & & }
& & & & & & & & & & & &
& & & & & & & & & & & & var left = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft)+trigger.position().left;
& & & & & & & & & & & & if (left+self.dh.width() & document.body.clientWidth) {
& & & & & & & & & & & & & & & & left = trigger.position().left + trigger.width() + scrollWidth - self.dh.width();
& & & & & & & & & & & & }
& & & & & & & & & & & & var top = Math.max(document.documentElement.scrollTop, document.body.scrollTop)+trigger.position().top;
& & & & & & & & & & & & if (top+self.dh.height()+trigger.height() & document.documentElement.clientHeight) {
& & & & & & & & & & & & & & & & top = top - self.dh.height() - 5;
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & top = top + trigger.height() + 5;
& & & & & & & & & & & & }
& & & & & & & & & & & & self.dh.css({top: top, left: left});
& & & & & & & & & & & & return true;
& & & & & & & & } & & &
& & & & & & & & //PNG透明图片
& & & & & & & & this.correctPNG = function() {
& & & & & & & & & & for(var i=0; i&document.images.length; i++) {
& & & & & & & & & & & & & & & & var img = document.images[i]
& & & & & & & & & & & & & & & & var imgName = img.src.toUpperCase()
& & & & & & & & & & & & & & & & if (imgName.substring(imgName.length-3, imgName.length) == &PNG&) {
& & & & & & & & & & & & & & & & & & & & var imgID = (img.id) ? &id='& + img.id + &' & : &&
& & & & & & & & & & & & & & & & & & & & var imgClass = (img.className) ? &class='& + img.className + &' & : &&
& & & & & & & & & & & & & & & & & & & & var imgTitle = (img.title) ? &title='& + img.title + &' & : &title='& + img.alt + &' &
& & & & & & & & & & & & & & & & & & & & var imgStyle = &display:inline-& + img.style.cssText
& & & & & & & & & & & & & & & & & & & & if (img.align == &left&) imgStyle = &float:& + imgStyle
& & & & & & & & & & & & & & & & & & & & if (img.align == &right&) imgStyle = &float:& + imgStyle
& & & & & & & & & & & & & & & & & & & & if (img.parentElement.href) imgStyle = &cursor:& + imgStyle &
& & & & & & & & & & & & & & & & & & & & var strNewHTML = &&span & + imgID + imgClass + imgTitle + & style=\&& + &width:& + img.width + & height:& + img.height + && + imgStyle + &;&+ &filter:progid:DXImageTransform.Microsoft.AlphaImageLoader& + &(src=\'& + img.src + &\', sizingMethod='scale');\&&&/span&&
& & & & & & & & & & & & & & & & & & & & img.outerHTML = strNewHTML;
& & & & & & & & & & & & & & & & & & & & i = i-1;
& & & & & & & & & & & & & & & & }
& & & & & & & & & & }
& & & & & & & & } & & & & & & &
& & & & & & & & //窗口初始化 & & &
& & & & & & & & this.initialize = function() {
& & & & & & & & & & & & self.initOptions();
& & & & & & & & & & & & self.initMask();
& & & & & & & & & & & & self.initBox(); & & & &
& & & & & & & & & & & & self.initContent();
& & & & & & & & & & & & self.initEvent();
& & & & & & & & & & & & self.correctPNG();& & & & & & &
& & & & & & & & & & & & return self;
& & & & & & & & }
& & & & & & & & //初始化
& & & & & & & & this.initialize();
& & & & } & & &
& & & & var weeboxs = function() {& & & & & & &
& & & & & & & & var self = this;
& & & & & & & & this._onbox = false;
& & & & & & & & this._opening = false;
& & & & & & & & this.boxs = new Array();
& & & & & & & & this.zIndex = 999;
& & & & & & & & this.push = function(box) {
& & & & & & & & & & & & this.boxs.push(box);
& & & & & & & & }
& & & & & & & & this.pop = function() {
& & & & & & & & & & & & if (this.boxs.length & 0) {
& & & & & & & & & & & & & & & & return this.boxs.pop();
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & return false;
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & & this.open = function(content, options) {
& & & & & & & & & & & & self._opening = true;
& & & & & & & & & & & & if (typeof(options) == &undefined&) {
& & & & & & & & & & & & & & & & options = {};
& & & & & & & & & & & & }
& & & & & & & & & & & & if (options.boxid) {
& & & & & & & & & & & & & & & & this.close(options.boxid);
& & & & & & & & & & & & }
& & & & & & & & & & & & options.zIndex = this.zIndex;
& & & & & & & & & & & & this.zIndex += 10;
& & & & & & & & & & & & var box = new weebox(content, options);
& & & & & & & & & & & & box.dh.click(function(){
& & & & & & & & & & & & & & & & self._onbox = true;
& & & & & & & & & & & & });
& & & & & & & & & & & & this.push(box);
& & & & & & & & & & & & return box;
& & & & & & & & }
& & & & & & & & this.close = function(id) {
& & & & & & & & & & & & if (id) {
& & & & & & & & & & & & & & & & for(var i=0; i&this.boxs.length; i++) {
& & & & & & & & & & & & & & & & & & & & if (this.boxs[i].dh.attr('id') == id) {
& & & & & & & & & & & & & & & & & & & & & & & & this.boxs[i].close();
& & & & & & & & & & & & & & & & & & & & & & & & this.boxs.splice(i,1);
& & & & & & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } else {
& & & & & & & & & & & & & & & & this.pop().close();
& & & & & & & & & & & & }
& & & & & & & & }
& & & & & & & & this.length = function() {
& & & & & & & & & & & & return this.boxs.length;
& & & & & & & & }
& & & & & & & & this.getTopBox = function() {
& & & & & & & & & & & & return this.boxs[this.boxs.length-1];
& & & & & & & & } & & &
& & & & & & & & this.find = function(selector) {
& & & & & & & & & & & & return this.getTopBox().dh.find(selector);
& & & & & & & & } & & & & & & &
& & & & & & & & this.setTitle = function(title) {
& & & & & & & & & & & & this.getTopBox().setTitle(title);
& & & & & & & & } & & & & & & &
& & & & & & & & this.getTitle = function() {
& & & & & & & & & & & & return this.getTopBox().getTitle();
& & & & & & & & } & & & & & & &
& & & & & & & & this.setContent = function(content) {
& & & & & & & & & & & & this.getTopBox().setContent(content);
& & & & & & & & } & & & & & & &
& & & & & & & & this.getContent = function() {
& & & & & & & & & & & & return this.getTopBox().getContent();
& & & & & & & & } & & & & & & &
& & & & & & & & this.hideButton = function(btname) {
& & & & & & & & & & & & this.getTopBox().hideButton(btname);& & & & & & & & & &
& & & & & & & & } & & & & & & &
& & & & & & & & this.showButton = function(btname) {
& & & & & & & & & & & & this.getTopBox().showButton(btname);& &
& & & & & & & & } & & & & & & &
& & & & & & & & this.setButtonTitle = function(btname, title) {
& & & & & & & & & & & & this.getTopBox().setButtonTitle(btname, title);
& & & & & & & & }
& & & & & & & & $(window).scroll(function() {
& & & & & & & & & & & & if (self.length() & 0) {
& & & & & & & & & & & & & & & & var box = self.getTopBox();
& & & & & & & & & & & & & & & & if (box.options.position == &center&) {
& & & & & & & & & & & & & & & & & & & & self.getTopBox().setCenterPosition();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & } & & & & & & & & & & &
& & & & & & & & });
& & & & & & & & $(document).click(function() {
& & & & & & & & & & & & if (self.length()&0) {
& & & & & & & & & & & & & & & & var box = self.getTopBox();
& & & & & & & & & & & & & & & & if(!self._opening && !self._onbox && box.options.clickClose) {
& & & & & & & & & & & & & & & & & & & & box.close();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & }
& & & & & & & & & & & & self._opening = false;
& & & & & & & & & & & & self._onbox = false;
& & & & & & & & });
& & & & }
& & & & $.extend({weeboxs: new weeboxs()}); & & & & & &
})(jQuery);
- 下载整个
相关源码/软件:
- 这是一个用到有图片、JavaScript的CSS圆角布局实例,压缩包中包含有用到的的有文件,带有阴影...
- 5个漂亮的CSS导航菜单,有红色、蓝色、银色、灰色等,非常漂亮,包括图片文件和CSS文件,拿来即用。
- dTree三级树形菜单,老外的东西,不过修改挺方便面的,你甚至可以把它改为动态读取数据库的,演示图在...
- vb编程实现填充渐变色,很简单的例子,对学习有帮助,可以研究一下。
- NEATPIC目录直读式图片管理程序,不需要数据库支持,直接遍历读取根目录下的文件夹,并自动读取图片...
- 一款可以专用于网站后台左侧可折叠展开的管理菜单(支持Cookies),可使用不同的方式配置,如哪些子...
- 一款基于ProtoType的CSS菜单,黑色风格,看上去很酷很漂亮,像DEDECMS默认风格中的菜单...
- 一个漂亮相册中的Js图片展示效果,这里只包括图片展示部分,一共有两种效果:鼠标点击后放大图片,另一种...
- 基于jQuery的超炫鼠标链接提示效果,动画显示提示,很不错,而且它本身也是一款漂亮的蓝色菜单,一举...
- 超级漂亮的仿Vista多级导航菜单,CSS+JavaScript技术结合共同打造,漂亮无敌,鼠标放上...
- Delphi流媒体音频转换程序,可以把网络上的流媒体转换成指定的音频格式。用到了Directshow...
- 一个很不错的屏幕按时锁定程序,可以设置屏幕在多少分钟内锁定和是否需要声音提醒。当锁定时间来到时它会有...
- 主要用到TMS Pack控件包中的TADVStringGrid控件!演示制作功能强大的统计数据和设计...
- QQ防盗登陆器,DELPHI版,完整源码包,适合学习。
- 这是一个不错的DBgrideh操作实例源码。它是一个单据管理软件。在录入数据时可以根据名称或拼音简码...
- 很逼真的电梯操作模拟程序,上楼、下楼、中间有人下楼等,然后到达某一楼层后自动开门,这个源码虽然牵扯到...
- 在标题栏显示按钮的实例源程序,也就是像有些播放软件一样,最小化的时候它会在当前操作窗口的标题栏右上角...
- 农信合系统的一个支票打印小程序,特点是可以对打印位置和打印字体大孝打印内容进行二次调节,通过这个代码...
- 看到网上一篇有关A*查找路径的问题讲得很透彻,就照虎画猫了一个,希望对大家有所帮助。由于时间紧,这个...
- 冰剑数据安全专家 BinJian Security Experts 是一款高效的数据加密软件,可以加...

我要回帖

更多关于 js 鼠标拖动 的文章

 

随机推荐