미디어위키:Common.js/libre-responsive-table.js: 두 판 사이의 차이

편집 요약 없음
편집 요약 없음
1번째 줄: 1번째 줄:
$(window).on( "load", function() {
$(window).on("load", function() {
     $('.libre-responsive-table').each(function() {
     $('.libre-responsive-table').each(function() {
         var $table = $(this);
         var $table = $(this);

2019년 10월 8일 (화) 17:51 판

$(window).on("load", function() {
    $('.libre-responsive-table').each(function() {
        var $table = $(this);
        var $cells = $table.find('tbody th, tbody td');
        var $heads = $table.find('thead th');
        var cellsPerRow = $heads.length;
        $heads.each(function(headIndex) {
            var text = $(this).text();
            $cells
                .filter(function(cellIndex) {
                    return cellIndex % cellsPerRow === headIndex;
                })
                .attr('data-th', text);
        });
    });
});