Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Select everything besides certain elements on a page

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #27087
    RohanJM
    Member

    Hi all,

    I want to set the opacity of all elements on the page to .5 except for the navigation and the logo.

    Is there a simple way to do this using jquery.

    Thanks
    Rohan Merchant

    #67599

    This is probably best achieved using CSS, unless you’re wanting to do it after the page has already loaded (i.e. when a user clicks something).

    If so, here is some sample code that I’ve just written (untested), based on http://docs.jquery.com/Selectors/all:

    $("*").css("style", "opacity:0.5;filter:alpha(opacity=50)");
    $("h1#logo").css("style", "opacity:1.0;filter:alpha(opacity=100)");
    $("ul#navigation").css("style", "opacity:1.0;filter:alpha(opacity=100)");

    Hope that helps!

    SM

    #67610
    RohanJM
    Member

    Nope that doesn’t seem to work at all… is there any way to exclude certain div’s from a selection… like $("body > div") but not div’s with an id of nav

    Thanks

    #67614
    RohanJM
    Member

    I got it to work

    Code:
    $(“#nav ul .main #products”).bind( “hover”, { speed:100, delay:100 }, function(){

    $(“body > div[id!=nav_wrapper], #upper_right_nav”).fadeTo(500, .3);

    });

    #67790
    RohanJM
    Member

    Even that seems to give me a bunch of problems so I got this plugin for jquery called expose http://flowplayer.org/tools/expose.html which works great.

    If you want to see it in action goto http://www.layersdesignstudio.com/websites/saloon_ro/

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.