使用以下 jQuery:
jQuery.fn.extend({
resizelis: function(xWidth) {
var mButtons = this.length;
var buttonSize = (xWidth / mButtons);
return this.each(function() {
this.css("width", buttonSize + "px");
this.children("a").css("width", buttonSize + "px");
});
}
});
我使用这样的方法:
var $width = $window.scrolltop() > $("#header_image").outerHeight() ? .92 * $(window).width() : .92 * $(".content").width();
$(".menu").children("li").resizelis($width);
HTML
<ul class="menu">
<li class="current"><a accesskey="1" href="index.html">Home</a></li>
<li><a accesskey="2" href="highlights.html">Highlights</a></li>
<li><a accesskey="3" href="agenda.html">Agenda</a></li>
<li><a accesskey="4" href="tracks.html">Tracks</a></li>
<li><a accesskey="5" href="sponsors.html">Sponsors / Exhibits</a></li>
<li><a accesskey="6" href="travel.html">Travel</a></li>
<li><a accesskey="7" href="register.html">Register</a></li>
</ul>
但这给了我一个错误。我到底在做什么错?谢谢。