Intelligent Triggers can not work

Intelligent Triggers can not work

I've written the code for two banners as below, but it doesn't work.
If I only use the one of code, it works well. I don't know why.

<!-- new Banner start -->
<div class="float_layer_hovertree" id="hovertree_float_layer" style="z-index:10001;
display: none;
position: fixed;
top: 185px;
box-shadow:1px 1px 10px -1px #aaa;
border-radius: 5px;
z-index: 10001;
width: auto;
max-width: 90%;
background-color: white;">
<h2 style="height: 25px; line-height: 25px; padding-left: 10px; font-size: 14px; color: #eee; position: relative; margin-top:0px; margin-bottom: 0px; border-radius:5px 5px 0px 0px; text-align: left">
<b style="color: #666666">News</b>
<a id="closeadv" href="javascript:;" class="close" target="_self" style="color:#666666; position: absolute; right: 12px;">
<i class="fa fa-times"></i>
</a>
</h2>
<div class="content" style="margin:5px; overflow: hidden; font-size: 14px; line-height: 18px; color: #666;">
<div class="wrap">
<a href=" http://www.chainsea.com.tw" target="_blank">
<img src=" http://www.lannerinc.com/images/stories/20180129-1.jpg" width="100%" />
</a>
</div>
</div>
<script type="text/javascript">
var $zoho = $zoho || {}; $zoho.salesiq = $zoho.salesiq ||
{ widgetcode: "7b292228c34529bdf9f53ac343a7470ffeef696e39490c60fb8202c4ae3c1b7c42fa8781fa49e20ab9814f8d02c0b7ba", values: {}, ready: function () { } };
var d = document; s = d.createElement("script"); s.type = "text/javascript"; s.id = "zsiqscript"; s.defer = true;
s.src = " https://salesiq.zoho.com/widget"; t = d.getElementsByTagName("script")[0]; t.parentNode.insertBefore(s, t); d.write("<div id='zsiqwidget'></div>");
</script>

<script>
$zoho.salesiq.ready = function (embedinfo) {
$zoho.salesiq.visitor.trigger(function (triggername, visitorinfo) {
if (triggername == 'Discount Banner') {
showDiscount();
}
});
};

// window.setTimeout(function(){showDiscount()},5000);

jQuery(function ($) {
$("#closeadv").click(function () {
$("#hovertree_float_layer").fadeOut("slow");
});

$(window).resize(function() {
console.log("hovertree_float_layer: " + $("#hovertree_float_layer").width() + " window: " + $(window).width());
var left = ($(window).width() - $("#hovertree_float_layer").width())/2 + "px";
$("#hovertree_float_layer").css("left",left);
});
});

function showDiscount() {
jQuery(function ($) {
$("#hovertree_float_layer").fadeIn("slow");
});
}

function setposotion() {
console.log("hovertree_float_layer: " + $("#hovertree_float_layer").width() + " window: " + $(window).width());
var left = ($(window).width() - $("#hovertree_float_layer").width())/2 + "px";
$("#hovertree_float_layer").css("left",left);
}

</script>
</div>
<!-- new Banner end -->




<!-- Banner start -->
<div class="float_layer_hovertree" id="hovertree_float_layer2" style="z-index:10001;
display: none;
position: fixed;
padding: 0;
margin: 0;
bottom: 105px;
right: 5px;
box-shadow:1px 1px 10px -1px #aaa;
border-radius: 5px;
z-index: 10001;
background-color: white;">
<h2 style="height: 25px; line-height: 25px; padding-left: 10px; font-size: 14px; color: #eee; position: relative; margin-top:0px; margin-bottom: 0px; border-radius:5px 5px 0px 0px; text-align: left">
<b style="color: #666666">News</b>
<a id="closeadv2" href="javascript:;" class="close" target="_self" style="color:#666666; position: absolute; right: 12px;">
<i class="fa fa-times"></i>
</a>
</h2>
<div class="content" style="margin:5px; overflow: hidden; font-size: 14px; line-height: 18px; color: #666;">
<div class="wrap">
<a href=" http://www.chainsea.com.tw" target="_blank">
<img src=" http://lannerinc.com/images/stories/20180129-5.jpg" width="100%" />

</a>
</div>
</div>
<script type="text/javascript">
var $zoho = $zoho || {}; $zoho.salesiq = $zoho.salesiq ||
{ widgetcode: "7b292228c34529bdf9f53ac343a7470ffeef696e39490c60fb8202c4ae3c1b7c42fa8781fa49e20ab9814f8d02c0b7ba", values: {}, ready: function () { } };
var d = document; s = d.createElement("script"); s.type = "text/javascript"; s.id = "zsiqscript"; s.defer = true;
s.src = " https://salesiq.zoho.com/widget"; t = d.getElementsByTagName("script")[0]; t.parentNode.insertBefore(s, t); d.write("<div id='zsiqwidget'></div>");
</script>

<script>
$zoho.salesiq.ready = function (embedinfo) {
$zoho.salesiq.visitor.trigger(function (triggername, visitorinfo) {
if (triggername == 'Discount Banner2') {
showDiscount2();
}
});
};
//window.setTimeout(function(){showDiscount2()},5000);

jQuery(function ($) {
$("#closeadv2").click(function () {
$("#hovertree_float_layer2").fadeOut("slow");
});
if ($(window).width() <= 414)
$("#hovertree_float_layer2").css("width","125px");
else if ($(window).width() > 414 && $(window).width() <= 768)
$("#hovertree_float_layer2").css("width","200px");
else
$("#hovertree_float_layer2").css("width","auto");
$(window).resize(function() {
if ($(window).width() <= 414)
$("#hovertree_float_layer2").css("width","125px");
else if ($(window).width() > 414 && $(window).width() <= 768)
$("#hovertree_float_layer2").css("width","200px");
else
$("#hovertree_float_layer2").css("width","auto");
});
});
function showDiscount2() {
jQuery(function ($) {
$("#hovertree_float_layer2").fadeIn("slow");
});
};

</script>
</div>
<!-- Banner end -->
    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方