Skip to content

Commit

Permalink
Merge pull request #18 from balibell/master
Browse files Browse the repository at this point in the history
avatar url changed
  • Loading branch information
balibell committed Mar 14, 2014
2 parents 846d9b1 + bc5dfbb commit 0e15b3f
Show file tree
Hide file tree
Showing 15 changed files with 2,659 additions and 2,199 deletions.
6 changes: 3 additions & 3 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ div.my-pic .mbpho .k img{float:left;+display:inline;margin:0 4px 4px 0;}
/* 分享者信息 收集数 回复数 */
.my-pic .w{clear:both;height:18px;overflow:hidden;padding:0 11px 12px 11px;margin:0;background-color:#f8f8f8;}
/* list 页面结合 42px 高度的区域 */
.my-pic div.d{overflow:hidden;height:28px;padding:0 11px 0 11px;background-color:#fff;margin:0;border-bottom:1px solid #efeeed;/*background:url(../../../../img/0/dtbutton.gif?20120106) 0 -568px no-repeat;*/}
.my-pic div.d{overflow:hidden;height:28px;padding:0 11px 0 11px;background-color:#fff;margin:0;border-bottom:1px solid #efeeed;}
.my-pic .d span{float:left;+display:inline;line-height:19px;padding:0 0 0 22px;margin:0 12px 0 0;background-image:url("http://cdn.duitang.com/uploads/files/201211/26/20121126121246_VXE8F.png");_background-image:url("http://cdn.duitang.com/uploads/files/201211/30/20121130160101_ePSJe.png");background-repeat:no-repeat;font-size:14px;color:#b4b4b4;}
.my-pic .d .d1{background-position:-220px 0;}
.my-pic .d .d1-done{background-position:-320px 0;}
Expand All @@ -39,11 +39,11 @@ div.my-pic .mbpho .k img{float:left;+display:inline;margin:0 4px 4px 0;}
.my-pic .d .d4{background-position:-220px -60px;}
.my-pic .d .d5{background-position:-220px -80px;}
/* 回复列表 */
.my-pic ul{padding:0 0 8px 0;background-color:#f8f8f8;}
.my-pic ul{zoom:1;display:block;padding:0 0 8px 0;background-color:#f8f8f8;}
.my-pic li{zoom:1;padding:8px 0 7px 0;margin:0 11px 0 11px;border-top:1px solid #efeeed;}
.my-pic li:after{content:"\0020";display:block;height:0;overflow:hidden;clear:both;}
.my-pic li img{float:left;+display:inline;margin:0 8px 0 0;}
.my-pic li p{float:left;width:165px;word-wrap:break-word;word-break:break-all;overflow:hidden;}
.my-pic li p{float:left;+display:inline;width:165px;word-wrap:break-word;word-break:break-all;overflow:hidden;}
.my-pic li i{font-size:10px;color:#bbb;margin-left:4px}
/*###################################################*/

Expand Down
36 changes: 18 additions & 18 deletions example-operate/delete.html

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions example-operate/order.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/fixedw.html

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions examples/main.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/messup.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/mobile.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/norequest.html

Large diffs are not rendered by default.

419 changes: 419 additions & 0 deletions examples/reinstall.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/sinkleft.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/sinkright.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions examples/specialcol.html

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions js/masnunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ if(!String.prototype.cut){
try{
var jsn = $.isPlainObject(h) ? h : $.parseJSON(h)
}catch(e){
console.log(e)
// 如果parse 失败,直接返回初始状态的 ret;
return ret;
}
Expand Down Expand Up @@ -219,7 +218,6 @@ if(!String.prototype.cut){
try{
var jsn = $.isPlainObject(h) ? h : $.parseJSON(h)
}catch(e){
console.log(e)
// 如果parse 失败,直接返回初始状态的 ret;
return ret;
}
Expand Down Expand Up @@ -257,7 +255,6 @@ if(!String.prototype.cut){
try{
var jsn = $.isPlainObject(h) ? h : $.parseJSON(h)
}catch(e){
console.log(e)
// 如果parse 失败,直接返回初始状态的 ret;
return ret;
}
Expand Down
182 changes: 90 additions & 92 deletions js/tabswitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,96 +3,94 @@
*/

;(function($){
//main 初始化
$.fn.tabswitch = function(fn,selector,op){
var $t = this;
//如果预计的第一个参数不是函数,则参数列左移一位
if( typeof fn !== 'function' ){
op = selector;
selector = fn;
fn = $.noop;
}
//如果预计的第二个参数不是字符串,则参数列左移一位
if( typeof selector !== 'string' ){
op = selector;
selector = '';
}

//如果预计的第三个参数不是对象,extend一个空对象
var opts = $.extend({},$.fn.tabswitch.defaults,op);
//fn 记录到opt 中去
opts.fn = fn;



//仅用作内部判断
var hasdelegate = !!selector;

//内容容器
var $conts = $(opts.cont),
//获取触发按钮
$trigs = hasdelegate ? $(selector,$t) : $t,
//当前状态的className 默认加上 cur className
fclass = opts.focus;



//设置当前tab 默认为0,设置完毕后将自动运行 _autodo 方法
_settab(opts.index)


if( !this.data('tabswitched') ){
//事件绑定,注意防止重复装载事件
if( hasdelegate ){
this.delegate(selector,opts.event,_clickdo)
}else{
this.bind(opts.event,_clickdo);
}
this.data('tabswitched',true)
}

//main 主事件执行
function _clickdo(e){
e.preventDefault();
_settab($trigs.index(this),true);
}
// _clickdo 方法结束

/*
描述:通过序号设置当前状态
参数:
i - (Num) 序号
b - (Bool) 如果是点击触发,或自动播放触发,则为 true,如果是初始化执行则为 false
*/
function _settab(i,b){
var $mtrigs = $trigs,
$pre,
prei = $trigs.index($pre),
mi = -1,
si = -1,
ci=i; // ci 表示当前要被显示的cont cont永远只显示一个

$pre = $mtrigs.filter('.'+fclass)
prei = $trigs.index($pre)

$mtrigs.add($conts).removeClass(fclass);

//重新设置trigs 和 conts 当前项加上 fclass
$conts.css('display','none').eq(ci).css('display','block').add($trigs.eq(i)).addClass(fclass);

//每次都执行
if( typeof opts.fn === 'function' ){
opts.fn($trigs,$conts,ci,prei,b);
}
}

return $t;
}

$.fn.tabswitch.defaults = { //默认配置
"cont" : ".tabswitch-cont", //切换内容块的选择器
"focus" : "cur", //聚焦状态的className 非选择器
"index" : 0, //初始状态下聚焦项的序号,默认为0
"event" : "click" //切换trigger 触发事件,默认是 click
};
//main 初始化
$.fn.tabswitch = function(fn,selector,op){
var $t = this;
//如果预计的第一个参数不是函数,则参数列左移一位
if( typeof fn !== 'function' ){
op = selector;
selector = fn;
fn = $.noop;
}
//如果预计的第二个参数不是字符串,则参数列左移一位
if( typeof selector !== 'string' ){
op = selector;
selector = '';
}

//如果预计的第三个参数不是对象,extend一个空对象
var opts = $.extend({},$.fn.tabswitch.defaults,op);
//fn 记录到opt 中去
opts.fn = fn;



//仅用作内部判断
var hasdelegate = !!selector;

//内容容器
var $conts = $(opts.cont),
//获取触发按钮
$trigs = hasdelegate ? $(selector,$t) : $t,
//当前状态的className 默认加上 cur className
fclass = opts.focus;



//设置当前tab 默认为0,设置完毕后将自动运行 _autodo 方法
_settab(opts.index)


//事件绑定,注意防止重复装载事件
if( hasdelegate ){
this.delegate(selector,opts.event,_clickdo)
}else{
this.bind(opts.event,_clickdo);
}


//main 主事件执行
function _clickdo(e){
e.preventDefault();
_settab($trigs.index(this),true);
}
// _clickdo 方法结束

/*
描述:通过序号设置当前状态
参数:
i - (Num) 序号
b - (Bool) 如果是点击触发,或自动播放触发,则为 true,如果是初始化执行则为 false
*/
function _settab(i,b){
var $mtrigs = $trigs,
$pre,
prei = $trigs.index($pre),
mi = -1,
si = -1,
ci=i; // ci 表示当前要被显示的cont cont永远只显示一个

$pre = $mtrigs.filter('.'+fclass)
prei = $trigs.index($pre)

$mtrigs.add($conts).removeClass(fclass);

//重新设置trigs 和 conts 当前项加上 fclass
$conts.css('display','none').eq(ci).css('display','block').add($trigs.eq(i)).addClass(fclass);

//每次都执行
if( typeof opts.fn === 'function' ){
opts.fn($trigs,$conts,ci,prei,b);
}
}

return $t;
}

$.fn.tabswitch.defaults = { //默认配置
"cont" : ".tabswitch-cont", //切换内容块的选择器
"focus" : "cur", //聚焦状态的className 非选择器
"index" : 0, //初始状态下聚焦项的序号,默认为0
"event" : "click" //切换trigger 触发事件,默认是 click
};
})(jQuery);
Loading

0 comments on commit 0e15b3f

Please sign in to comment.