<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" type="text/css" href="http://shaojie.me/wp-content/example/styles/base.css"/>
<link rel="stylesheet" type="text/css" href="http://shaojie.me/wp-content/example/styles/item.css"/>
<script type="text/javascript" src="scripts/mootools-core-1.3.2.js"></script>
</head>
<body>
<div id="main-content-full">
<iframe id="resize" src="buy.php" frameborder="0" scrolling="no"></iframe>
</div>
</body>
</html>
内部iframe页面:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" type="text/css" href="http://shaojie.me/wp-content/example/styles/base.css"/>
<link rel="stylesheet" type="text/css" href="http://shaojie.me/wp-content/example/styles/item.css"/>
<script type="text/javascript" src="http://shaojie.me/wp-content/example/scripts/mootools-core-1.3.2.js"></script>
</head>
<body>
<div id="main-content-full">
<div class="main-content-row species">
<div class="bd">
<table>
<tbody>
<tr>
<th>
<a href="BuyerList.aspx?cat=110000">
女装/女士精品:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=110800&Q=">
连衣裙</a></li>
<li><a href="BuyerList.aspx?Cat=110400&Q=">
T恤</a></li>
<li><a href="BuyerList.aspx?Cat=111800&Q=">
裤子</a></li>
<li><a href="BuyerList.aspx?Cat=111700&Q=">
春夏装</a></li>
<li><a href="BuyerList.aspx?Cat=110500&Q=">
衬衫</a></li>
<li><a href="BuyerList.aspx?Cat=112300&Q=">
蕾丝衫/雪纺衫</a></li>
<li><a href="BuyerList.aspx?Cat=111900&Q=">
半身裙</a></li>
<li><a href="BuyerList.aspx?Cat=110100&Q=">
针织衫</a></li>
<li><a href="BuyerList.aspx?Cat=112200&Q=">
小背心/小吊带</a></li>
<li><a href="BuyerList.aspx?Cat=110600&Q=">
小西装</a></li>
<li><a href="BuyerList.aspx?Cat=110900&Q=">
皮衣</a></li>
<li><a href="BuyerList.aspx?Cat=110300&Q=">
短外套</a></li>
<li><a href="BuyerList.aspx?Cat=112800&Q=">
婚纱/旗袍/礼服</a></li>
<li><a href="BuyerList.aspx?Cat=112400&Q=">
牛仔裤</a></li>
<li><a href="BuyerList.aspx?Cat=112900&Q=">
马夹</a></li>
<li><a href="BuyerList.aspx?Cat=111500&Q=">
羽绒服</a></li>
<li><a href="BuyerList.aspx?Cat=110700&Q=">
卫衣</a></li>
<li><a href="BuyerList.aspx?Cat=111600&Q=">
羽绒背心/棉背心</a></li>
<li><a href="BuyerList.aspx?Cat=110200&Q=">
毛衣</a></li>
<li><a href="BuyerList.aspx?Cat=111400&Q=">
棉衣</a></li>
<li><a href="BuyerList.aspx?Cat=111100&Q=">
风衣</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=100000">
男装:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=100400&Q=">
长袖衬衫</a></li>
<li><a href="BuyerList.aspx?Cat=100300&Q=">
长袖T恤</a></li>
<li><a href="BuyerList.aspx?Cat=100500&Q=">
休闲长裤</a></li>
<li><a href="BuyerList.aspx?Cat=101000&Q=">
牛仔裤</a></li>
<li><a href="BuyerList.aspx?Cat=101100&Q=">
卫衣</a></li>
<li><a href="BuyerList.aspx?Cat=100100&Q=">
羽绒服</a></li>
<li><a href="BuyerList.aspx?Cat=100900&Q=">
西服</a></li>
<li><a href="BuyerList.aspx?Cat=100800&Q=">
毛衣/线衣</a></li>
<li><a href="BuyerList.aspx?Cat=100700&Q=">
风衣</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=180000">
童装/亲子装:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=181000&Q=">
儿童T恤/吊带衫</a></li>
<li><a href="BuyerList.aspx?Cat=180600&Q=">
儿童裙子</a></li>
<li><a href="BuyerList.aspx?Cat=180100&Q=">
儿童套装</a></li>
<li><a href="BuyerList.aspx?Cat=181300&Q=">
儿童裤子</a></li>
<li><a href="BuyerList.aspx?Cat=180400&Q=">
儿童毛衣</a></li>
<li><a href="BuyerList.aspx?Cat=181200&Q=">
儿童衬衫</a></li>
<li><a href="BuyerList.aspx?Cat=181500&Q=">
其它童装</a></li>
<li><a href="BuyerList.aspx?Cat=180800&Q=">
长裤</a></li>
<li><a href="BuyerList.aspx?Cat=180300&Q=">
儿童卫衣/绒衫</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=160000">
女鞋:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=160300&Q=">
帆布鞋</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=170000">
服饰配件:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=170200&Q=">
腰带/皮带/腰链</a></li>
<li><a href="BuyerList.aspx?Cat=171200&Q=">
其它配件</a></li>
<li><a href="BuyerList.aspx?Cat=170100&Q=">
帽子</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=150000">
男鞋:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=150300&Q=">
休闲皮鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150200&Q=">
运动休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150100&Q=">
日常休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151600&Q=">
凉拖</a></li>
<li><a href="BuyerList.aspx?Cat=150900&Q=">
商务休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151300&Q=">
懒人鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150300&Q=">
休闲皮鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150200&Q=">
运动休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150100&Q=">
日常休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151600&Q=">
凉拖</a></li>
<li><a href="BuyerList.aspx?Cat=150900&Q=">
商务休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151300&Q=">
懒人鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150300&Q=">
休闲皮鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150200&Q=">
运动休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=150100&Q=">
日常休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151600&Q=">
凉拖</a></li>
<li><a href="BuyerList.aspx?Cat=150900&Q=">
商务休闲鞋</a></li>
<li><a href="BuyerList.aspx?Cat=151300&Q=">
懒人鞋</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=190000">
家居鞋类:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=190100&Q=">
拖鞋</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
<tr>
<th>
<a href="BuyerList.aspx?cat=120000">
内衣/家居服:</a>
</th>
<td>
<ul>
<li><a href="BuyerList.aspx?Cat=120700&Q=">
男士内裤</a></li>
<li><a href="BuyerList.aspx?Cat=120100&Q=">
文胸</a></li>
<li><a href="BuyerList.aspx?Cat=120200&Q=">
女士内裤</a></li>
<li><a href="BuyerList.aspx?Cat=120400&Q=">
保暖内衣</a></li>
<li><a href="BuyerList.aspx?Cat=122300&Q=">
短袜/打底袜/丝袜/静脉曲张袜</a></li>
</ul>
</td>
<td>
<a href="javascript:void(0)" class="more">more</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
/*products species*/
var itemMore = {
initialize: function() {
this.uls = $$(".species ul");
this.mores = $$(".species .more");
this.mores.each(function(more, i) {
this.toggleItem(more, this.uls[i], i);
}, this)
},
toggleItem: function(more, ul, i) {
ul.setStyle("height", "auto");
if (ul.getSize().y > 18) {
var store = true;
ul.setStyle("height", "18px")
}
if (!store) {
more.setStyle("display", "none");
}
more.addEvent("click", function(e) {
e.stop();
this.toggleClass("up");
ul.toggleClass("item");
})
}
}
itemMore.initialize();
top.$("resize").set({
styles: {
width: 760,
height: 1200
}
})
</script>
</body>
</html>
问题演示页链接是: http://shaojie.me/wp-content/example/home.php
第五行不应显示更多(更多)按钮,但会显示。任何人都可以帮助我吗?感谢。
答案 0 :(得分:2)
似乎显示第五行的“更多”按钮,因为<ul>
的高度超过18像素,即使该行中只有一条水平文本行。
如果我直接导航到http://shaojie.me/wp-content/example/buy.php,我看不到问题。
也许您应该使用更大的阈值,例如
// ...
if (ul.getSize().y > 24) {
var store = true;
ul.setStyle("height", "18px")
}
// ...
或者,使用“更智能”的测试 - 不依赖于<ul>
的高度的测试。如何计算<li>
s的数量?假设有4列<li>
s,那么,
// ...
if (ul.getElements("li").length > 4) {
var store = true;
ul.setStyle("height", "18px")
}
// ...