搜索框中的空格不起作用

时间:2014-03-12 16:46:37

标签: magento

我在网上搜索,无法找到问题的答案。在网上商店www.toner123.si(magento platforma)我有"搜索框"。我使用免费产品Catalog_Search_Refinement 1.0.7。每当我进入在线商店并进入搜索框时,我就无法使用"空格键"。无法用空格写任何单词。 在我执行一个搜索周期后,它可以正常运行。你知道什么是错的吗?

谢谢

1 个答案:

答案 0 :(得分:0)

此问题与您的 js / magentothem / ma.style1.js 文件有关。

在第178行附近,您有以下代码:

if(settings.allowKeyboardCtrl){
    $bn1(document).bind('keydown', function(e){
        if(e.which==39){
            nextSlide = ActSlide-1;
            stopAutoplay();
            jumpTo(nextSlide);
        }else if(e.which==37){
            prevSlide = ActSlide+1;
            stopAutoplay();
            jumpTo(prevSlide);
        }else if(e.which==32){
            if(intval){stopAutoplay();}
            else{autoplay();}
            return false;
        }
    });

问题在于return false;。由于您将keydown事件绑定到document,因此e.which==32(空格键)返回false将阻止空格键完全正常工作。如果是这种情况,只需从此处移除return false;即可再次使用,如下所示:

if(settings.allowKeyboardCtrl){
    $bn1(document).bind('keydown', function(e){
        if(e.which==39){
            nextSlide = ActSlide-1;
            stopAutoplay();
            jumpTo(nextSlide);
        }else if(e.which==37){
            prevSlide = ActSlide+1;
            stopAutoplay();
            jumpTo(prevSlide);
        }else if(e.which==32){
            if(intval){stopAutoplay();}
            else{autoplay();}
        }
    });