If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member djsquid's Avatar
    Join Date
    Aug 2011
    Member #
    Hey all,

    I'm working on a summer project for university, and I am 99% finished on it, there is just one small thing that I am stuck on;

    I have a navigation system with a sub menu within one of the anchors, the sub menu has fadeIn on it when you click on the anchor, and so what I am after is;

    When the sub menu is visible, I need the homepage opacity to drop to 25%, and when the sub menu is hidden I need the homepage opacity to come back to 100%

    I thought this was possible through an If, else statement but as I am a novice I am unsure of this, and so far got this;

    if ($('.sub1').is(':visible') ) {
    $(".homepage").fadeTo(500, .25);}
    else {
    $(".homepage").fadeTo(500, 1);
    I have also tried this via .CSS which partially works, when the sub menu is visible the Homepage opacity drops but then when I click #cat and the sub menu is hidden, the homepage won't come back to 100% opacity ;

        if ($('.sub1').css('opacity') == .25 ) {
            $('.homepage').fadeTo(500, 1);
        } else {
            $('.homepage').fadeTo(500, .25);


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search tags for this page

if else statement opacity javascript


jquery if visible else

Click on a term to search for related topics.
All times are GMT -6. The time now is 11:23 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: