views:

31

answers:

4

hello guys! i have a question for you

this is the xhtml

<div id="main">
    <div id="category1">
        <div id="product1"></div>
        <div id="product2"></div>
        <div id="product3"></div>
    </div>

    <div id="category2">
        <div id="product4"></div>
        <div id="product5"></div>
        <div id="product6"></div>
    </div>

</div>

the concept is:

  • by default #container1 is shown on the website
  • by clicking on the menu "container2" #container2 fades in and #container1 fades out
  • i have a second level menu to select the products.. and that's the only thing that works fine.

productX are absolute positioned inside the containerX which are related positioned

the script looks fine to me, but the products divs doesn't fade out at all!

this is the script

function controlCategory(a) {
   $("#category1").fadeOut();
                        $("#category2").fadeOut();
   $(a).fadeIn();
 }



     $(function () {

  $("#anchor1").click(function(event) {
   event.preventDefault();
   controlCSS(this);
   controlCategory("#category1");
  });

           $("#anchor2").click(function(event) {
   event.preventDefault();
   controlCSS(this);
   controlCategory("#category2");
  });

 });

does anybody know why the category divs doesn't fade out????

thanks in advance!

A: 

Is the javascritpt code for the html code? In the html you have containerX ids and your javascript has categoryX ids.

Plaudit Design - Web Design
+2  A: 

Update for updated question: the code you posted works, though it's a bit glitchy the fade works, you can test it here. Something outside your question (perhaps a parent is hidden?) is interfering here.


Previous answer: Your IDs don't match, you have #category1 for your selector but your elements have id="container1", so your jQuery selectors just aren't finding any elements. Just change either side so they match up.

Nick Craver
This is the same as what I posted a few seconds before you. Isn't amazing how quick these things get answered?? :)
Plaudit Design - Web Design
@Plaudit - Yup, formatting takes a few seconds longer to post ;)
Nick Craver
check the code you posted on fiddle, i update fades to slides and added css.check how the categories slides up and down, but the text just pop.http://jsfiddle.net/andyvasile/3jKvQ/6/
Andy
A: 

Your question confuses me. Why did container suddenly become category?

Estel
A: 

yeah, sorry guys, i can't copy and paste the real code, i wrote it again to show you how should they work

Andy
Use comments instead of posting an answer to respond...also if you're not pasting the actual code, it's *very* difficult to debug, since you're introducing new problems.
Nick Craver