Wednesday 15 May 2013

jquery - Tell an element to show itself based on the status of others on the page? -


There are 3 hidden divisions on my page, and a general general "Welcome" message. On the left side of these divs there are some items that are clicked, toggle their corresponding divs (as well as other divs). It has to work with all purpose.

  var $ jq = jQuery.noConflict (true); $ Jq (function () {$ jq ("# fade1"). Click (function () {$ jq ("# div1"). FeedToggle (750); $ jq ("# div2"). FadeOut (1) ; $ Jq ("# div3") .FadeOut (1); $ jq ("# welcomediv"). Feedout (1);}); $ jq ("# fade2") Click (function () {$ jq FadeOut (1); $ jq ("# div2"). FadeToggle (750); $ jq ("# welcomediv" ($ 1); $ jq ("# div3"). $ Jq ("# fade3") Click (function () {$ jq ("# div1"). FadeOut (1); $ jq ("# FadeOut (1); $ jq ("# day3") .FedTagle (750); $ jq ("# VelkMidiv"). Fadeaut (1);});});   

Then I tried to add an event statement that welcomes the message He tells you to show himself if someone else does not appear, as if the user has clicked one to click it, then clicked it again to fade it out of the user's behavior Spaces can be omitted for.

  if ($ jq ("# div1: hidden") and $ jq ("# div2: hidden") & amp; & Amp; $ Jq ("# day3: hidden")) {(function () {$ jq ("# velkmidiv"). FadeIn (500);}); };   

I have also tried to check the CSS directly, like

  if ($ jq ("# div1"). CSS ("Display" , "CSS" ("Display", "None") & amp; $ jq ("# div3") CSS ("Display", "None") {$ Jq ("# welcomediv"). Fidine (500); } ($ '(' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ' 

}

None of these work. Divisions are still faded and out when their related links are clicked, but if my statements do nothing The idea is:

Use an element to see if something is invisible:

  if ($ jq (selector) .is (': hidden') and ...)   

You should also be able to check that All three are visible using:

  if ($ jq ('# div1: hidden, # div2: hidden, # div3: hidden'). Length === 3) {...}    

No comments:

Post a Comment