Fix bug.
This commit is contained in:
parent
174e0d657b
commit
93c7fc6bfb
|
@ -38,7 +38,7 @@
|
||||||
</div>
|
</div>
|
||||||
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function combineul(){
|
function combineul_{{subpart-id}}(){
|
||||||
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
||||||
parents.each(function(i,v){
|
parents.each(function(i,v){
|
||||||
for(var i=1;i<$(v).find('ul.w-annc__list').length;i++)
|
for(var i=1;i<$(v).find('ul.w-annc__list').length;i++)
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
};
|
};
|
||||||
var num;
|
var num;
|
||||||
var lilength = $('[data-subpart-id=\"{{subpart-id}}\"] li.w-annc__item').length;
|
var lilength = $('[data-subpart-id=\"{{subpart-id}}\"] li.w-annc__item').length;
|
||||||
function reorganize(num){
|
function reorganize_{{subpart-id}}(num){
|
||||||
var uls = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').toArray();
|
var uls = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').toArray();
|
||||||
var currentul = uls.findIndex(function(v){
|
var currentul = uls.findIndex(function(v){
|
||||||
return $(v).hasClass("active") && !$(v).hasClass("hidden_item");
|
return $(v).hasClass("active") && !$(v).hasClass("hidden_item");
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
var li_active_idx = 0;
|
var li_active_idx = 0;
|
||||||
if(currentul != 0)
|
if(currentul != 0)
|
||||||
li_active_idx = $(uls[currentul]).find("li.w-annc__item").eq(0).index("li.w-annc__item");
|
li_active_idx = $(uls[currentul]).find("li.w-annc__item").eq(0).index("li.w-annc__item");
|
||||||
combineul();
|
combineul_{{subpart-id}}();
|
||||||
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
||||||
parents.each(function(i,v){
|
parents.each(function(i,v){
|
||||||
var lilength = $(v).find('li.w-annc__item').length;
|
var lilength = $(v).find('li.w-annc__item').length;
|
||||||
|
@ -99,25 +99,25 @@
|
||||||
};
|
};
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
if($(window).width()>1024){
|
if($(window).width()>1024){
|
||||||
reorganize(3);
|
reorganize_{{subpart-id}}(3);
|
||||||
num=3;
|
num=3;
|
||||||
}else if($(window).width()>576){
|
}else if($(window).width()>576){
|
||||||
reorganize(2);
|
reorganize_{{subpart-id}}(2);
|
||||||
num=2;
|
num=2;
|
||||||
}else{
|
}else{
|
||||||
reorganize(1);
|
reorganize_{{subpart-id}}(1);
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
if($(window).width()>1024){
|
if($(window).width()>1024){
|
||||||
reorganize(3);
|
reorganize_{{subpart-id}}(3);
|
||||||
num=3;
|
num=3;
|
||||||
}else if($(window).width()>576){
|
}else if($(window).width()>576){
|
||||||
reorganize(2);
|
reorganize_{{subpart-id}}(2);
|
||||||
num=2;
|
num=2;
|
||||||
}else{
|
}else{
|
||||||
reorganize(1);
|
reorganize_{{subpart-id}}(1);
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
var flag=false;
|
var flag=false;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
function combineul(){
|
function combineul_{{subpart-id}}(){
|
||||||
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
||||||
parents.each(function(i,v){
|
parents.each(function(i,v){
|
||||||
for(var i=1;i<$(v).find('ul.w-annc__list').length;i++)
|
for(var i=1;i<$(v).find('ul.w-annc__list').length;i++)
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
};
|
};
|
||||||
var num;
|
var num;
|
||||||
var lilength = $('[data-subpart-id=\"{{subpart-id}}\"] li.w-annc__item').length;
|
var lilength = $('[data-subpart-id=\"{{subpart-id}}\"] li.w-annc__item').length;
|
||||||
function reorganize(num){
|
function reorganize_{{subpart-id}}(num){
|
||||||
combineul();
|
combineul_{{subpart-id}}();
|
||||||
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
var parents = $('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list').parent();
|
||||||
parents.each(function(i,v){
|
parents.each(function(i,v){
|
||||||
var lilength = $(v).find('li.w-annc__item').length;
|
var lilength = $(v).find('li.w-annc__item').length;
|
||||||
|
@ -79,28 +79,29 @@
|
||||||
$(v).find('ul.w-annc__list').eq(0).find("li.w-annc__item").eq(num).remove();
|
$(v).find('ul.w-annc__list').eq(0).find("li.w-annc__item").eq(num).remove();
|
||||||
})
|
})
|
||||||
$('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list >li').css('width','calc('+100/num+'% - '+20/16+'em)'); //20px=>li的margin
|
$('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list >li').css('width','calc('+100/num+'% - '+20/16+'em)'); //20px=>li的margin
|
||||||
|
$('[data-subpart-id=\"{{subpart-id}}\"] ul.w-annc__list >li').css("float","left");
|
||||||
};
|
};
|
||||||
$(window).resize(function(){
|
$(window).resize(function(){
|
||||||
if($(window).width()>1024){
|
if($(window).width()>1024){
|
||||||
reorganize(3);
|
reorganize_{{subpart-id}}(3);
|
||||||
num=3;
|
num=3;
|
||||||
}else if($(window).width()>576){
|
}else if($(window).width()>576){
|
||||||
reorganize(2);
|
reorganize_{{subpart-id}}(2);
|
||||||
num=2;
|
num=2;
|
||||||
}else{
|
}else{
|
||||||
reorganize(1);
|
reorganize_{{subpart-id}}(1);
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
if($(window).width()>1024){
|
if($(window).width()>1024){
|
||||||
reorganize(3);
|
reorganize_{{subpart-id}}(3);
|
||||||
num=3;
|
num=3;
|
||||||
}else if($(window).width()>576){
|
}else if($(window).width()>576){
|
||||||
reorganize(2);
|
reorganize_{{subpart-id}}(2);
|
||||||
num=2;
|
num=2;
|
||||||
}else{
|
}else{
|
||||||
reorganize(1);
|
reorganize_{{subpart-id}}(1);
|
||||||
num=1;
|
num=1;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue