/**
* Calculates and assigns equal widths
* to each multiple choice items
*
*/
function equalWidths(ulId) {
$(ulId).each(function(){
var getLength = $(this).find('li').length;
var getPercent = 100/getLength;
if($(window).width()>=992){
$(this).find('li').css('width',getPercent+'%');
} else {
$(this).find('li').css('width','');
}
});
$(window).on("load resize", function(){
$(ulId).each(function(){
var getLength = $(this).find('li').length;
var getPercent = 100/getLength;
if($(window).width()>=992){
$(this).find('li').css('width',getPercent+'%');
} else {
$(this).find('li').css('width','');
}
});
});
};
Friday, June 29, 2018
Dinamically assign percentage widths for equally spaced li elements
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment