jQuery 幻灯片切换
我有这个 jquery 代码,它显示我的 div 并隐藏它,没有问题,但我在将其从 css 显示更改为 SlideToggle 显示时遇到问题?
$('li.trigger').hover(
function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'block'); },
function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'none'); });
I have this jquery code which displays my div and hides it no problem but im having trouble changing it from css display to slideToggle display?
$('li.trigger').hover(
function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'block'); },
function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'none'); });
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试一下,如果您不需要滑动
div
,那么只需将.slideUp()
移动到与slideDown
相同的上面一行Give this a go, if u dnt need to slide the
div
s then just move.slideUp()
to the line above same withslideDown
这是有效的
Heres what worked