无法在 Safari 中隐藏元素(jQuery、css)

Can't hide element in Safari (jQuery, css)

这是一个 jQuery 加载页面进度条叠加层,在 FF、Chrome 和 Edge 中工作得很好。
我无法在 Safari(Mac 和 iOS)和 IE 中达到 100% 后隐藏它。

这是脚本:

document.onreadystatechange = function(e)
{
if(document.readyState=="interactive")
{
var all = document.getElementsByTagName("*");
document.getElementById("preload_div").style.display="block";
for (var i=0, max=all.length; i < max; i++) 
{
set_ele(all[i]);
}
}
}
function check_element(ele)
{
var all = document.getElementsByTagName("*");
var totalele=all.length;
var per_inc=100/all.length;

    if($(ele).on())
{
    var prog_width=per_inc+Number(document.getElementById("preload_pro_width").value);
    document.getElementById("preload_pro_width").value=prog_width;
    $("#preload_bar1").animate({width:prog_width+"%"},10,function(){
    if(document.getElementById("preload_bar1").style.width=="100%")
    {
        $(".preload_pro").fadeOut("slow");                        //  Not working on Safari
        // $("#preload_div").css('display', 'none');                  Not working on Safari
        // $(".preload_pro").css('display', 'none');                  Not working on Safari
        // $(".preload_pro").animate({"opacity": "0"}, "slow");       Not working on Safari
    }           
    });
}
else    
{
    set_ele(ele);
}
}
function set_ele(set_element)
{
check_element(set_element);
}


这是 CCS:

.preload_pro {
    position: fixed;
    left:0px;
    top:0px;
    width:100%;
    height:100%;
    z-index:9999;
    background-color:#ffffff
    }
.preload_bar {
    background-color:#000000;
    width:0%;
    height:3px
    }
.preload_per {
    position:absolute;
    display:inline-block;
    top:3px;
    left:48%
    }


最后 HTML:

    <div class='preload_pro' id="preload_div">
    <div class='preload_bar' id='preload_bar1'></div>
    <div class='preload_per' id='preload_per1'></div>
    </div>

    <h1>The content</h1>

    <input type="hidden" id="preload_pro_width" value="0">

有人可以发现错误吗?任何解决方法?提前致谢!

试试这个:

jQuery:

$(".preload_pro").addClass("hideContent"); 

CSS:

.hideContent {
  display: none;
}