1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Focus on div and darker the rest area

Discussion in 'jQuery' started by colombo, Oct 5, 2011.

  1. #1
    I need an HTML page with white background and swf file in the center of it.
    lets say the swf file will be 640 width and 480 height, what i want is that when the mouse will be inside the swf area the rest of the area (outside the game area) will become darker (similar to what happen with lightbox), and also the darker area will not be clickable , it will come back to normal (not darker) only 1 second after the mouse will be out of the swf area.

    Any idea how i can do that?

    thanks for the help...
     
    colombo, Oct 5, 2011 IP
  2. SheetalCreation

    SheetalCreation Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #2
    you need to attach mouse hover event to image and background both.
    When users mouse is hovering on image that even will trigger.
    and when users mouse is hovering on background then background mouse hover will trigger.
    write color change code in both events call back functions.

    Code will look like following :

    say swf image id is "swf"
    and other darker color id is "dark"
    var image = document.getElementById("swf");
    var area = document.getElementById("dark");

    now add event for both elements, for adding event i am writing plain JS code you can write javaquery as well

    if(document.addEventListener){
    image.addEventListener(mouseOver,"callback function name",false);
    image.addEventListener(mouseOut,"callback function name",false);
    dark.addEventListener(mouseOver,"callback function name",false);
    dark.addEventListener(mouseOut,"callback function name",false);
    }
    else{
    use attachEvents for IE
    }

    now create call back function for all and write your color change code in that..




    Sheetal
     
    SheetalCreation, Oct 6, 2011 IP