Catalin Seo价格滑块不适用于手机(magento)

时间:2016-09-10 21:24:49

标签: magento

https://www.magentocommerce.com/magento-connect/layered-navigation-seo.html存在问题。价格滑块无法在移动设备上运行。请帮忙!

1 个答案:

答案 0 :(得分:1)

在文件app / design / frontend / {your-theme} /default/template/catalin_seo/catalog/layer/price.phtml

替换

    CatalinSeoHandler.bindPriceSlider();

使用

    var bindPriceSliderStop = false;
    if(window.innerWidth < 770) {
        jQuery('body').on('click', '.block-layered-nav .block-content.accordion-open > dl > dt.current', function(){
            if(jQuery('.current .price-slider').length && !bindPriceSliderStop){
                CatalinSeoHandler.bindPriceSlider();
                bindPriceSliderStop = true;
            }   
        });
    }else{
        CatalinSeoHandler.bindPriceSlider();
    }

    jQuery(window).on("orientationchange",function(event){
        if(window.innerWidth > 770) {
            catalinSeoHandlerMobile();              
        }else{
            jQuery('body').on('click', '.block-layered-nav .block-content.accordion-open > dl > dt.current', function(){
                if(jQuery('.current .price-slider').length){
                    catalinSeoHandlerMobile();
                }   
            });
            if(jQuery('.current .price-slider').length){
                catalinSeoHandlerMobile();
            }
        }
    });

    function catalinSeoHandlerMobile(){
        CatalinSeoHandler.priceSlider.currentMinPrice = parseFloat(jQuery('#price-min-display').text());
        CatalinSeoHandler.priceSlider.currentMaxPrice = parseFloat(jQuery('#price-max-display').text());
        CatalinSeoHandler.bindPriceSlider();
    }

还有另一个问题,价格滑块不支持移动触摸事件。如果您想解决此问题,请替换标准magento滑块js文件

  

“js / scriptaculous / slider.js”

有了这个

  

http://dev.amnuts.com/slider/js/slider.js