褪色淡入淡出背景图象 [英] fadein fadeout background image

查看:113
本文介绍了褪色淡入淡出背景图象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我向您提供一个链接 jsfiddle.net/swati712/4Zx5q ,您可以在其中查看单击左上角的绿色圆按钮,背景图像显示为fadeIn jquery函数,一旦您离开图像区域,该图像就会出现fadeOut和灰色背景。但现在我想要有人鼠标在任何灰色区域,然后图像将不会出现不只是点击绿色按钮。我知道它是一个非常简单的任务,但需要帮助这个。

Here I am giving you a link jsfiddle.net/swati712/4Zx5q where as you can see by clicking Green Circle button on top left hand side, a background image appear as a fadeIn jquery function and once you are out of the image area, that image got fadeOut and grey background reappear. But now I want when someone mouse over any grey area then the image will appear not just click the green button. I know its a very simple task but need help regarding this.

推荐答案

我想你想把悬停处理程序的元素与灰色背景颜色(请参阅小提琴):

I think you want to put the hover handler on the element with the grey background color (see fiddle):

$('#container').hover(function() {
    $(".main1").fadeIn();
    $(".logo").fadeOut();
    $(".logo-left").fadeIn();
}, function(){
});

如果你不打算将鼠标悬停功能限制为灰色元素,整个页面上的事件,您可以更改jquery选择器以定位文档元素:

If you're not bothered about restricting the hover functionality to the grey element, and you want to catch the event on the entire page, you could change the jquery selector to target the document element:

$(document).hover(function() { /* hover code here */});

这篇关于褪色淡入淡出背景图象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆