Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you are refering to image opacity when a black background is behind the image. Am I right?</p> <p>If so, then make a div element right after the declaration of body, and set the div you created to have the same size as body. Set body to have black background.<br> Then when you hover over .first, .second or .third it will change the image of the div instead of body. Example:</p> <pre><code>$(document).ready(function() { var colorOrig= $("#yourDiv").css('background-image'); var imgOpacity = 0.5; $(".first").hover( function() { $("#yourDiv").css({ 'background-image': 'url(images/foto-de-skater.jpg)', opacity:imgOpacity }); }, function() { $("#yourDiv").css({ 'background-image': colorOrig, opacity:imgOpacity }); }); $(".second").hover( function() { $("#yourDiv").css({ 'background-image': 'url(images/girls.jpg)', opacity:imgOpacity }); }, function() { $("#yourDiv").css({ 'background-image': colorOrig, opacity:imgOpacity }); }); $(".third").hover( function() { $("#yourDiv").css({ 'background-image': 'url(images/inter0507fumoniCurvaSudRoma1973.jpg)', opacity:imgOpacity }); }, function() { $("#yourDiv").css({ 'background-image': colorOrig, opacity:imgOpacity }); });}); </code></pre> <p>EDIT:</p> <pre><code>$(document).ready(function() { function fadeImage (img) { $("body").stop(true).animate ({ opacity: 0 }, 'fast', function () { $(this).css ('background-image', img).animate ({ opacity: 1 }, 'fast'); }); } var colorOrig=$("body").css('background-image'); $(".first").hover( function() { fadeImage ('url(images/foto-de-skater.jpg)'); }, function() { fadeImage (colorOrig); }); $(".second").hover( function() { fadeImage ('url(images/girls.jpg)'); }, function() { fadeImage (colorOrig); }); $(".third").hover( function() { fadeImage ('url(images/inter0507fumoniCurvaSudRoma1973.jpg)'); }, function() { fadeImage (colorOrig); });}); </code></pre> <p>Latest fiddle: <a href="http://jsfiddle.net/7KWjz/21/" rel="nofollow">http://jsfiddle.net/7KWjz/21/</a> Full screen: <a href="http://jsfiddle.net/7KWjz/21/embedded/result/" rel="nofollow">http://jsfiddle.net/7KWjz/21/embedded/result/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload