飞飞CMS官方论坛

标题: 怎么在下面js里加个‘收起’功能 [打印本页]

作者: SSw00wl4    时间: 2019-12-4 14:17
标题: 怎么在下面js里加个‘收起’功能
怎么在下面js里加个‘收起’功能  'more':function(){//...效果
                $('.ff-playurl').each(function(i){
                        $this = $(this);
                        $config = $this.attr('data-more')*1;
                        $max = $this.find('li a').size();
                        if(($config+2) < $max && $config>0){
                                $max_html = $($this.find('li:last').prop("outerHTML")).find('a').attr('href','#all').html('全部...');
                                $max_html = '<li class="'+$this.find('li').attr('class')+'">'+$max_html.prop("outerHTML")+'</li>';
                                $this.find('li').each(function(n){
                                        if(n+1 > $config){
                                                $(this).hide();
                                        }
                                });
                                $this.find('li').eq($config).after($max_html);
                                $this.find('li:last').show();
                        }
                 });
                //more点击
                $('.ff-playurl').on('click', 'a', function(e){
                        if($(this).attr('href') == '#all'){
                                $(this).parent().parent().find('li').show();
                                $(this).parent().remove();
                                return false;
                        }
                });
        },





欢迎光临 飞飞CMS官方论坛 (http://www.feifeicms.top/) Powered by Discuz! X3.2