在Firefox 58版

时间:2018-01-30 10:33:35

标签: jquery css firefox cross-browser

我有一个选择框菜单,它在Firefox 58中无法点击鼠标。 但在以前的版本中它的工作正常。它也可以在其他浏览器中正常工作。我的代码如下所示:

<div class="custom-select custom-select-result custom-select-sort data-filter">
            <select id="sort-select-1">
                <option value="lowtohigh">Price (Low-High)</option>
                <option value="hightolow">Price (High-Low)</option>
                <option value="brand">Brand</option>
                <option value="mileage">Mileage Warranty</option>
                <option value="wet">Wet</option>
                <option value="dry">Dry</option>
                <option value="comfort">Comfort</option>
                <option value="winter">Winter/Snow</option>
                <option value="tread">Treadwear</option>
            </select>
        </div>

CSS:

  .top-result-container .custom-select-result.custom-select-sort {
        background-position: 95% 15%;
        padding-right: 11px;
    }

    .top-result-container .custom-select-result {
        display: inline-block;
        padding-right: 25px;
        margin-left: 5px;
        border: 0;
        position: relative;
        overflow: visible;
    }

.custom-select {
    padding: 0 0 1px;
    margin: 0;
    border: 1px solid #999;
    width: auto;
    border-radius: 0;
    overflow: hidden;
    background-color: #fff;
    background-position: 95% 50%;
    background-repeat: no-repeat;
    background-image: url('');
}

添加了JS:

$(".custom-select-result").click(function(evt){
    evt.stopPropagation();
    if($(this).hasClass('custom-selected')){
        $(".filter-details").hide();
        $(".custom-select-result").removeClass("custom-bg custom-selected");
    }else{
        $('.data-filter .filter-details').hide();
        $('.custom-select-result').removeClass("custom-bg custom-selected");
        $(this).addClass("custom-bg custom-selected data-filter");
        $(this).children().show();
    }
    if (!!navigator.userAgent.match(/iPad/i)) {
        $('body').addClass('results-grid-filter-active');
    }

});

请检查上面的JS代码。我使用了click事件,这段代码在chrome中工作正常而不是firefox。

0 个答案:

没有答案