2016-09-15 70 views

回答

10

Yuval嘿!

试试这个脚本来解决你的问题。

if(jQuery('html').attr('dir') == 'rtl'){ 
 
     jQuery('[data-vc-full-width="true"]').each(function(i,v){ 
 
      jQuery(this).css('right' , jQuery(this).css('left')).css('left' , 'auto'); 
 
     }); 
 
    }

将这个脚本代码jQuery中(窗口).load。

希望这会帮助你:)

+0

不错,但是在调整大小时仍然存在问题:( – Iggy

4

可能是更容易使用CSS来解决这个问题,当页面被调整过它会工作。 查找排课前[数据VC-全宽=“真”]和CSS等添加到您的rtl.css

.before-fullwidth-row { 
    direction: ltr; 
} 
.before-fullwidth-row > div { 
    direction: rtl; 
} 

似乎工作...

0

如果你想固定VC行也window resize使用此解决方案:

$(window).on('resize', function() { 
     $('.rtl [data-vc-full-width="true"]').each(function(){ 
      $(this).css('right' , $(this).css('left')).css('left' , 'auto'); 
     }); 
    }).resize(); 
0

WordPress的视觉作曲全宽的行(行stretche)定出RTL

jQuery(document).ready(function() { 

function bs_fix_vc_full_width_row(){ 
    var $elements = jQuery('[data-vc-full-width="true"]'); 
    jQuery.each($elements, function() { 
     var $el = jQuery(this); 
     $el.css('right', $el.css('left')).css('left', ''); 
    }); 
} 

// Fixes rows in RTL 
jQuery(document).on('vc-full-width-row', function() { 
    bs_fix_vc_full_width_row(); 
}); 

// Run one time because it was not firing in Mac/Firefox and Windows/Edge some times 
bs_fix_vc_full_width_row(); 
}); 

Source