0
我的网站垂直滑动内容。但是会发生什么:如果我在主屏幕上,并想点击最后一个菜单项(简报)..滑动显示所有内容在到达目的地链接(简报)之前..逐个滑动内容,否则显示全部内容
所以..我想要要知道,我需要做的只是滑动我点击的菜单项,否则所有的内容。
这是我的工作地点这个问题:http://www.alsite.com.br/luxxx
这是我的滑脚本:
$(document).ready(function() {
//get all link with class panel
$('a.panel').click(function() {
//reset and highlight the clicked link
$('a.panel').removeClass('selected');
$(this).addClass('selected');
//grab the current item, to be used in resize function
current = $(this);
//scroll it to the destination
$('#wrapper').scrollTo($(this).attr('href'), 800);
//cancel the link default behavior
return false;
});
//resize all the items according to the new browser size
$(window).resize(function() {
//call the resizePanel function
resizePanel();
});
function resizePanel() {
//get the browser width and height
width = $(window).width();
height = $(window).height();
//get the mask height: height * total of items
mask_height = height * $('.item').length;
//set the dimension
$('#wrapper, .item').css({width: width, height: height});
$('#mask').css({width: width, height: mask_height});
//if the item is displayed incorrectly, set it to the corrent pos
$('#wrapper').scrollTo($('a.selected').attr('href'), 0);
}
});
感谢您的帮助!
要展开:将所有其他的div显示:无(或我想.hide() )来折叠它们。除了CURRENT div和要滚动的div。 – DaiYoukai 2012-07-17 18:37:26
哼哼..我现在试试吧! – Preston 2012-07-17 18:39:11
我不知道我是否做得对,但不工作。 '$(this).addClass('selected current');'我把你提供给我的代码 – Preston 2012-07-17 18:46:38