Skip to content

Commit

Permalink
fix: 节点长度过长时显示省略号
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaoo committed Dec 30, 2016
1 parent 5ca2a70 commit 6be2f47
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
8 changes: 8 additions & 0 deletions css/tree.css
Expand Up @@ -100,6 +100,14 @@ website: http://code.google.com/p/jquerytree/
line-height: 16px;
margin-right: 2px;
}

.ztree li > a > span:last-child {
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
width: 80%;
}

.ztree li span.button {
line-height: 0;
margin: 0;
Expand Down
8 changes: 5 additions & 3 deletions dist/css/tree.css
Expand Up @@ -194,8 +194,10 @@ website: http://code.google.com/p/jquerytree/

// width: 21px;
// height: 15px;
width: 21px;
height: 21px;
// width: 21px;
// height: 21px;
width: 18px;
height: 18px;
}
.ztree li span.button.root_open {
background-position: -92px -54px;
Expand Down Expand Up @@ -441,7 +443,7 @@ ul.ztree.zTreeDragUL {
border-color: #bcbcbc;
}

.ztree li.focusNode span.button.switch {
.ztree li.focusNode>span.button.switch {
color: #FFFFFF;
}

Expand Down
2 changes: 1 addition & 1 deletion dist/css/tree.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions dist/js/u-tree.js
Expand Up @@ -1198,16 +1198,21 @@
// parPaddingLeft=parseInt(setting.treeObj.css('paddingLeft')),
parPaddingLeft=9,
checkboxLength=18,
iconLength=21,
// 第一个图片的宽度
iconLength=18,
pLeft,
fontStyle = [];

if(setting.check.enable){
pLeft=checkboxLength+parPaddingLeft+iconLength*(node.level+1) + 30 +'px';
mLeft = checkboxLength+parPaddingLeft+iconLength*(node.level+1) +'px';

// pLeft=checkboxLength+parPaddingLeft+iconLength*(node.level+1) + 30 +'px';
// 因为a标签前面的图标设置成了absolute,所以忽略前面的宽度即减去21px
pLeft=checkboxLength+parPaddingLeft+iconLength*(node.level) + 30 +'px';

mLeft = checkboxLength+parPaddingLeft+iconLength*(node.level) +'px';
}else{
pLeft=parPaddingLeft+iconLength*(node.level+1)+30+'px';
mLeft=parPaddingLeft+iconLength*(node.level+1)+'px';
pLeft=parPaddingLeft+iconLength*(node.level)+30+'px';
mLeft=parPaddingLeft+iconLength*(node.level)+'px';
}
fontStyle.push('padding-left', ":",pLeft, ";");
fontStyle.push('margin-left', ":", '-'+mLeft, ";");
Expand Down
2 changes: 1 addition & 1 deletion dist/js/u-tree.min.js

Large diffs are not rendered by default.

0 comments on commit 6be2f47

Please sign in to comment.