1(function ($) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note that this assume you're going to use jQuery, so it prepares 9 * the $ function reference to be used within the scope of this 10 * function. 11 * 12 * From here, you're able to define handlers for when the DOM is 13 * ready: 14 * 15 * $(function() { 16 * 17 * }); 18 * 19 * Or when the window is loaded: 20 * 21 * $( window ).load(function() { 22 * 23 * }); 24 * 25 * ...and so on. 26 * 27 * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler 28 * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may 29 * be doing this, we should try to minimize doing that in our own work. 30 */ 31 32 function resizeColumns() { 33 let columns = $('.dc-elementor-hidden-column'); 34 columns.each(function (index, column) { 35 column = $(column); 36 let hiddenSize = parseFloat(column.data('size')), 37 row = column.closest('.elementor-row'), 38 children = row.find('> .elementor-column'), 39 rowSize = 0; 40 41 if (children.length === 0) { 42 return; 43 } 44 45 // get percent-width of row 46 children.each(function (cIndex, child) { 47 child = $(child); 48 rowSize += parseFloat(child.width() / row.width() * 100); 49 }); 50 51 children.each(function (cIndex, child) { 52 // resize columns 53 child = $(child); 54 let childSize = parseFloat(child.width() / row.width() * 100), 55 newSize = childSize + (hiddenSize * (childSize / rowSize)); 56 57 if (childSize < 100) { 58 child.css({width: newSize + '%'}); 59 } 60 }); 61 62 }); 63 } 64 65 function resetColumns() {
66 let columns = $('.dc-elementor-hidden-column'); 67 columns.each(function (index, column) { 68 column = $(column); 69 let row = column.closest('.elementor-row'), 70 children = row.find('> .elementor-column'); 71 72 // reset width for recalc 73 children.css({width: ''}); 74 }); 75 } 76 77 78 $(window).on('resize', function () { 79 resetColumns(); 80 resizeColumns(); 81 }); 82 83 $(window).on('elementor/frontend/init', function () { 84 resetColumns(); 85 resizeColumns(); 86 }); 87})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.