用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - javascript代码库

弹出滑块效果

2014-10-30 作者: js特效源码下载举报

[javascript]代码库

<script type="text/javascript" src="js/jquery.min.js">
</script>
<script type="text/javascript">
    $(function() {
        /**
                * solve IE AJAX cache problem
                */
        $.ajaxSetup({
            cache: false
        });
 
        /**
                * the index of the current element / blog selected
                * and the total number of elements / blogs
                */
        var current = -1;
        var total = $('#friendsList').children().length;
 
        /**
                * when we click on a blog link,
                * we get the latest post with an AJAX request
                */
        $('#friendsList a').bind('click',
        function(e) {
            var $this = $(this);
            show();
            var $elem = $this.parent();
            current = $elem.index() + 1;
            var source = $elem.attr('class');
            /**
                    * add the title and image of the blog
                    */
            $('#blog_info').empty().html('<img src="images/' + source + '.jpg"></img>' + $this.find('em').html());
            $.get('rss.class.php', {
                source: source
            },
            function(data) {
                $('#latest_post').removeClass('loading').html(data);
            });
            e.preventDefault();
        });
 
        /**
                * show the dialog with the post
                */
        function show() {
            $('#overlay').show();
            if (!$('#modal').is(':visible')) $('#modal').css('left', '-260px').show().stop().animate({
                'left': '50%'
            },
            500);
        }
 
        /**
                * hide the dialog
                */
        function hide() {
            $('#modal').stop().animate({
                'left': '150%'
            },
            500,
            function() {
                $(this).hide();
                $('#overlay').hide();
                $('#latest_post').empty();
            });
        }
 
        /**
                * clicking on the cross hides the dialog
                */
        $('#modal .close').bind('click',
        function() {
            hide();
        });
 
        /**
                * clicking on the next on the dialog
                */
        $('#modal .next').bind('click',
        function(e) {
            if (current == total) {
                e.preventDefault();
                return;
            }
            $('#latest_post').empty().addClass('loading');
            $('#friendsList li:nth-child(' + parseInt(current + 1) + ')').find('a').trigger('click');
            e.preventDefault();
        });
 
        /**
                * clicking on the prev on the dialog
                */
        $('#modal .prev').bind('click',
        function(e) {
            if (current == 1) {
                e.preventDefault();
                return;
            }
            $('#latest_post').empty().addClass('loading');
            $('#friendsList li:nth-child(' + parseInt(current - 1) + ')').find('a').trigger('click');
            e.preventDefault();
        });
    });
</script>


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...