javascript - How to add hyperlink in the min.js function -
function(){i.image&&(s.cover.classlist.add(o+"-cover"),s.cover.style.width=i.imagewidth+"px", s.cover.style.backgroundimage="url("+i.image+")", s.cover.style.height=i.imagewidth+"px", i.rtl?s.toastbody.style.marginright=i.imagewidth+10+"px":s.toastbody.style.marginleft=i.imagewidth+10+"px",s.toast.appendchild(s.cover))}(),
the outcome javascript above below:
<div class="izitoast-cover" style="width: 70px; background-image:url”../img/123.jpg”);"></div>
i add onclick function on become:
<div class="izitoast-cover" **onclick="location.href='newurl.html';"** style="width: 70px; background-image: url”../img/123.jpg”);"></div>
i have try s.cover.onclick.location.href='newurl.html', not working.
can tell me should add on js code?
so add event listener
s.cover.addeventlistener("click", function () { window.location.href = "http://www.example.com"; });
Comments
Post a Comment