Jquery On Hover:使用文本覆盖淡化背景

发布于 2024-11-29 16:36:20 字数 213 浏览 5 评论 0原文

我正在尝试创建一种翻转效果,将图像的不透明度淡化至 20%,并将文本覆盖在 div 顶部。我已经能够使其淡出并显示文本,但由于某种原因,当它们组合在一起时效果不佳。我发现与我想做的最接近的事情是: http://damiencorrell.com/ 除了我正在尝试将背景淡化至 20%。感谢您的所有帮助!

I am trying to create a rollover effect that fades the image to 20% opacity and also overlaying text on top of the div. I have been able to make it fade, and reveal the text but for some reason it doesn't work well when they are combined. The closest thing that I have found to what I am trying to do is this: http://damiencorrell.com/ except for I am trying to get the background to fade to 20%. Thanks for all of the help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

躲猫猫 2024-12-06 16:36:20

尝试这样的事情:

// change yourimage for your "#imageid" or ".imageclass"
$('yourimage').hover(function(){
  // fade to 0.2 ( 20% ) in 300ms
  $(this).fadeTo(300, 0.2);
}, function(){
  // restore opacity to 1 im 300ms
  $(this).fadeTo(300, 1);
});

try something like this:

// change yourimage for your "#imageid" or ".imageclass"
$('yourimage').hover(function(){
  // fade to 0.2 ( 20% ) in 300ms
  $(this).fadeTo(300, 0.2);
}, function(){
  // restore opacity to 1 im 300ms
  $(this).fadeTo(300, 1);
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文