逐个滑动内容,否则显示所有内容

时间:2012-07-17 18:16:41

标签: jquery html css

我的网站垂直滑动内容。但是发生了什么:如果我在主屏幕上,并且想要点击最后一个菜单项(新闻稿)..滑动显示所有内容,然后到达目的地链接(新闻稿)..

所以...我想知道,我只需要点击我点击的菜单项,我需要做什么,否则所有内容。

这是我的工作网站出现此问题: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);

}


    });

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

当然,只需隐藏除了当前显示的屏幕以外的所有其他屏幕以及要显示和滑过的屏幕。如果您可以在当前正在查看的课程上放置.current课程,请按以下步骤操作:

$('.item').hide();
$((this).attr('href')).add('.current').show();
$('#wrapper').scrollTo($(this).attr('href'), 800);
相关问题