Một cách sử dụng create <style> để thêm style (ok)

var pi = $('.testlistenout .testlistenpercent').length;
  if(pi <4) {
    items = pi;
  }else {
    items = 4;
    var style = document.createElement('style');
    style.innerHTML = '.testlistenout .owl-stage{height:150px}.testlistenout .owl-item{float:left;position:relative;height:calc(50% - 10px)}.testlistenout .owl-item>.testlistenpercent{position:absolute;left:50%}.testlistenout .owl-item:nth-child(n)>.testlistenpercent{top:calc(100% + 20px)}.testlistenout .owl-item:nth-child(1)>.testlistenpercent{top:0}.testlistenout .owl-item:nth-child(2)>.testlistenpercent{top:0}.testlistenout .owl-item:nth-child(3)>.testlistenpercent{top:0}.testlistenout .owl-item:nth-child(4)>.testlistenpercent{top:0}';
    var ref = document.querySelector('script');
   }

Last updated