在几秒钟内隐藏woocommerce-message [英] Hide woocommerce-message in couple seconds
本文介绍了在几秒钟内隐藏woocommerce-message的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用此代码隐藏 woocommerce-message,但它不起作用.
I tried to use this code to hide woocommerce-message but it doesn't work.
setTimeout(function() {
$('.woocommerce-message').fadeOut('fast');
}, 5000); // <-- time in mseconds
你有其他解决方案吗?我试图将此代码放入 header.php 并且我的模板有用于自定义标题 JavaScript 代码的空间,但没有任何效果.
Do you any another solutions ? I tried to put this code into header.php and my template has space for Custom Header JavaScript Code but nothing works.
推荐答案
这对我有用.
setTimeout(function() {
$('.woocommerce-message').fadeOut('fast')
}, 5000);
如果您使用的是 wordpress,请尝试
If you're using wordpress, try
setTimeout(function() {
jQuery('.woocommerce-message').fadeOut('fast')
}, 5000);
此链接也可能对您有所帮助:jQuery|点击淡出和/或自动淡出
This link may help you as well: jQuery | on click fade out and / or automatically fade out
这篇关于在几秒钟内隐藏woocommerce-message的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文