使用jQuery页面之间滑动

问题描述 投票:6回答:2

我有一个4页的网站,我想在4页用滑动效果之间过渡。我不想做这个用#ID。我想按按钮或链接滑动到下一个页面。我知道这是可以使用jQuery做,我已经看到了网站,做到这一点。请大家帮帮忙。预先感谢所有的建议,批评和意见。

jquery slide
2个回答
8
投票

看看这个教程和示例http://www.queness.com/post/356/create-a-vertical-horizontal-and-diagonal-sliding-content-website-with-jquery

基本上,你必须设置你的CSS和HTML将所有你想要的div的面板/屏幕 - 行和列。

然后为每个面板的选择器,并从link]结合点击事件[代码。

$(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();
    });

});

3
投票

我建议使用jQuery内容关闭屏幕上滑动,做到这一点使用AJAX刷新内容到新页之后。设置内容到屏幕的另一侧,并再次使用jQuery它从侧面滑入。

事情是这样的......

<div id='wrapper'> // this has a set width and overflow hidden
  <div id='content'>
    your content
  </div>
</div>

路段上的用户点击,动画的“内容”保证金所以它熄灭的页面。做你的AJAX-ING,在“内容”页面的另一侧位置(远远不够,所以你不能看到它),动画保证金所以它会滑入视图。

© www.soinside.com 2019 - 2024. All rights reserved.