【问题标题】:Wordpress visual composer RTL on window resizeWordpress 可视化作曲家 RTL 调整窗口大小
【发布时间】:2017-12-29 05:03:23
【问题描述】:

继续这篇文章: Wordpress Visual Composer Strech Row and Direction RTL

这个 jQuery 解决方案非常适合窗口加载:

    jQuery(window).load(function () {
    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 wordpress visual-composer


    【解决方案1】:

    如果您想在窗口调整大小和窗口加载时修复 VC Row,请使用此解决方案:

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

    【讨论】:

      【解决方案2】:

      为获得更好的结果,请使用 vc-full-width-row jQuery 自定义事件类型并将您的代码放入事件处理程序回调函数中。

      jQuery(document).on('vc-full-width-row', function($element) {
      
          jQuery('.rtl [data-vc-full-width="true"]').each( function(i,v) {
      
              var left = jQuery(this).css('left'),
                  right = jQuery(this).css('right'),
                  padding_left =  jQuery(this).css('padding-left'),
                  padding_right =  jQuery(this).css('padding-right');
      
              jQuery(this).
              css('right', left ).
              css('left',  right ).
              css('padding-left', padding_right ).
              css('padding-right', padding_left );
          });
      
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-09-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-18
        • 1970-01-01
        相关资源
        最近更新 更多