85 lines
3.0 KiB
Plaintext
85 lines
3.0 KiB
Plaintext
|
<div class="i-annc index-publications-3">
|
||
|
<h3 class="i-annc__page-title">{{page-title}}</h3>
|
||
|
<ul class="i-annc__list row" data-level="0" data-list="publications">
|
||
|
<li class="i-annc__item col-md-4">
|
||
|
<a href="{{link_to_show}}">
|
||
|
<div class="i-annc__img-wrap">
|
||
|
<img class="i-annc__img" src="{{cover}}" alt="{{cover_description}}" title="{{cover_description}}">
|
||
|
</div>
|
||
|
<div class="i-annc__content-wrap">
|
||
|
<div class="i-annc__meta">
|
||
|
<span class="i-annc__status-wrap" data-list="statuses" data-level="1">
|
||
|
<span class="i-annc__status label {{status-class}}">{{status}}</span>
|
||
|
</span>
|
||
|
<span class="i-annc__postdate-wrap" date-format="%Y-%m">
|
||
|
<i class="fa fa-calendar-o"></i>
|
||
|
<span class="i-annc__postdate">{{pub_date}}</span>
|
||
|
</span>
|
||
|
<span class="i-annc__category-wrap">
|
||
|
<i class="fa fa-tasks"></i>
|
||
|
<span class="i-annc__category">{{category}}</span>
|
||
|
</span>
|
||
|
</div>
|
||
|
<h4 class="i-annc__entry-title">
|
||
|
<a class="i-annc__title" href="{{link_to_show}}">{{title}}</a>
|
||
|
</h4>
|
||
|
</div>
|
||
|
</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
{{pagination_goes_here}}
|
||
|
<script>
|
||
|
var lilength = $('.index-publications-3 li.i-annc__item').length;
|
||
|
function combineul(){
|
||
|
for(var i=1;i<$('.index-publications-3 ul.i-annc__list').length;i++)
|
||
|
$('.index-publications-3 ul.i-annc__list').eq(0).find('>li').eq(-1).after($('.index-publications-3 ul.i-annc__list').eq(i).html());
|
||
|
var ullength = $('.index-publications-3 ul.i-annc__list').length;
|
||
|
for(var i = 1;i < ullength;i++)
|
||
|
$('.index-publications-3 ul.i-annc__list').eq(-1).remove();
|
||
|
};
|
||
|
function reorganize(num){
|
||
|
combineul();
|
||
|
for(var i=1;i< Math.ceil(lilength/num);i++){
|
||
|
$('.index-publications-3 ul.i-annc__list').eq(-1).after('<ul class="i-annc__list row" data-level="0" data-list="announcements"></ul>')
|
||
|
var lihtml="";
|
||
|
if(i != (Math.ceil(lilength/num)-1)){
|
||
|
for(var j=0;j<num;j++)
|
||
|
lihtml += "<li class='i-annc__item col-md-4'>"+$('.index-publications-3 li.i-annc__item').eq(i*num+j).html()+"</li>"
|
||
|
}else{
|
||
|
for(var j=0;j< lilength - num *(Math.ceil(lilength/num)-1) ;j++)
|
||
|
lihtml += "<li class='i-annc__item col-md-4'>"+$('.index-publications-3 li.i-annc__item').eq(i*num+j).html()+"</li>"
|
||
|
};
|
||
|
$('.index-publications-3 ul.i-annc__list').eq(-1).html(lihtml);
|
||
|
};
|
||
|
if(Math.ceil(lilength/num) != 1 )
|
||
|
for(var i=0;i< lilength -num ; i++ )
|
||
|
$('.index-publications-3 ul.i-annc__list').eq(0).find("li.i-annc__item").eq(num).remove();
|
||
|
$('.index-publications-3 ul.i-annc__list >li').css('width','calc('+100/num+'% - '+20/20+'em)'); //20px=>li的margin
|
||
|
};
|
||
|
$(document).ready(function(){
|
||
|
if($(window).width()>1024){
|
||
|
reorganize(3);
|
||
|
num=3;
|
||
|
}else if($(window).width()>576){
|
||
|
reorganize(2);
|
||
|
num=2;
|
||
|
}else{
|
||
|
reorganize(1);
|
||
|
num=1;
|
||
|
}
|
||
|
});
|
||
|
$(window).resize(function(){
|
||
|
if($(window).width()>1024){
|
||
|
reorganize(3);
|
||
|
num=3;
|
||
|
}else if($(window).width()>576){
|
||
|
reorganize(2);
|
||
|
num=2;
|
||
|
}else{
|
||
|
reorganize(1);
|
||
|
num=1;
|
||
|
}
|
||
|
})
|
||
|
</script>
|