我的自定义代码与 WordPress 网站中的其他一些 JavaScript 文件发生冲突。
发生冲突的代码在这里。当我删除 jQuery 的 google API 时,除了这段代码之外,一切都工作正常,然后它就停止工作了。我尝试使用 noconflict 修改代码,但没有帮助。也许我做错了。
当脚本存在时,它会使地址传送检查器停止工作。
<script>$.noConflict();</script><script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="pondelok" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="utorok" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="streda" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="stvrtok" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="piatok" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="sobota" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 21:00.</h4>
</div>
<div id="nedela" class="msg">
<h4>Objednávky dnes prijímame od 11:00 do 20:00.</h4>
</div>
<script>
var Now = new Date();
var CurrentDay = Now.getDay();
var CurrentHrs = Now.getHours();
if (CurrentDay == 1 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#pondelok').show();
}else if (CurrentDay == 2 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#utorok').show();
} else if (CurrentDay == 3 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#streda').show();
} else if (CurrentDay == 4 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#stvrtok').show();
} else if (CurrentDay == 5 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#piatok').show();
} else if (CurrentDay == 6 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#sobota').show();
} else if (CurrentDay == 0 && (CurrentHrs >= 00 && CurrentHrs <= 24)) {
$('.msg').hide()
$('#nedela').show();
} else{
$('.msg').hide()
$('#no_del').show();
}
Smart猫小萌
相关分类