【问题标题】:How to Calculating with variable height如何计算可变高度
【发布时间】:2016-06-08 12:46:40
【问题描述】:

对于我们与 Magento 的结帐,我使用来自 h-o.nl 的 Improved OPC design(css only)

每个 .opc-step-* 都有 postion:absolute,但 #checkoutSteps 有一个静态的最小高度。所以每一步对于 .opc-step-* 都有另一个高度

当客户有很多产品要结帐时,将超出 div 的最小高度。

所以我需要将 .opc-step-* 的 div 高度设置为 #checkoutSteps 的最小高度。进展顺利。但它需要多出 80 px 的高度。 divHeight + 80px 如何计算?

这是我没有计算 opcheckout.js 的功能

gotoSection: function (section, reloadProgressBlock) {

        if (reloadProgressBlock) {
            this.reloadProgressBlock(this.currentStep);
        }
        this.currentStep = section;
        var sectionElement = $('opc-' + section);
        sectionElement.addClassName('allow');
        this.accordion.openSection('opc-' + section);
        if(!reloadProgressBlock) {
            this.resetPreviousSteps();
        }
        jQuery("html, body").delay(10).animate({
            scrollTop: (
                jQuery("#opc-"+section).offset().top - jQuery('#header').height()
            )
        },
        50);
        var divHeight = jQuery("#checkout-step-"+ section).outerHeight( true );
        jQuery('#checkoutSteps').css('min-height', divHeight+'px');
    },

【问题讨论】:

    标签: javascript jquery css magento opc


    【解决方案1】:

    我修好了

    jQuery('#checkoutSteps').css('min-height', divHeight+'px');
    

    改成:

    jQuery('#checkoutSteps').css({'min-height':(divHeight+80)+'px'});
    

    【讨论】:

      猜你喜欢
      • 2013-03-28
      • 2021-12-18
      • 2018-01-11
      • 1970-01-01
      • 2011-11-02
      • 2013-11-06
      • 2014-02-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多