我在avalonbyeaw.com的导航上成功实现了 scrollTo 脚本,我的客户希望从主页添加链接。容易,对吧?我猜不是。它不仅不会滚动,而且还会添加#finishes
到我们从导航链接中删除的 URL。我猜我只需要将链接添加到某处的函数?我想不通。
Javascript
$(document).ready(function() {
$('a.panel').click(function () {
$('a.panel').removeClass('selected');
$(this).addClass('selected');
current = $(this);
$('#wrapper').scrollTo($(this).attr('href'), 800);
return false;
});
$(window).resize(function () {
resizePanel();
});
});
function resizePanel() {
width = $(window).width();
height = $(window).height();
mask_width = width * $('.item').length;
$('#debug').html(width + ' ' + height + ' ' + mask_width);
//$('#wrapper, .page').css({width: width, height: height});
//$('#stage').css({width: mask_width, height: height});
$('#wrapper').scrollTo($('a.selected').attr('href'), 0);
}
工作导航链接html
<div id="nav-finishes" class="nav"><a href="#finishes" class="panel panel-finishes" alt="finishes"><img src="images/spacer.gif" height="10" width="79" border="0" /></a></div>
添加到piecemaker xml提要中的非工作链接
<Text><p>Avalon by EAW features automotive-class finishes on all trim pieces. <a href="#finishes" class="panel">Optional premium enclosure finishes</a> set these systems in a class by themselves.</p></Text>