1
在我的網站重要的是,我使用tawk.toCSS刪除內嵌在JavaScript加載插件
我想ovveride它的CSS,這樣當用戶打印的頁面不顯示小工具。然而,小部件容器帶有內聯樣式「display:block!important;」我無法重寫。
以下代碼不起作用。任何想法?
<!--Start of Tawk.to Script-->
<script type="text/javascript">
var $_Tawk_API={},$_Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/my_id/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
$(function(){
$('#tawkchat-iframe-container').removeProp('display');
console.log('removed'); //actually logged but the property is not removed.
});
</script>
設置其高度爲0 - 或者,如果你不需要的空間,設置它的不透明度爲0 - 或,將它的寬度設置爲0 - 很多選項... –
@DarrenSweeney Brilliant。如果沒有這些選項,您也可以使用!important來設置顯示,並根據特異性擊敗另一個setter。 – trex005
如果使用'$('#tawkchat-iframe-container')。attr('style','');'...? –