SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jul 2009
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Entire chunk of my website just not displaying. Stumped!

    No idea whats going on. Please see the link below. any of the pages under 'catelog' are not displaying the items I had programmed in. If you do a view source, you will see all the content within <div class="toggle_container"> is not showing. I double checked all my css paths, and my jquery paths, but I just can't make sense of why its not showing?

    Also this happened out of nowhere. I did not change anything within these files for months. Maybe some issue with my host?

    http://embetc.com/catalog-fire.php

    EDIT: Just noticed that the sections i had are quickly animating and disappearing all together. Looks like its a jquery problem. Can someone move to appropriate forum?

    Thanks!!

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi there,

    On each of these pages you have the following code:

    Code JavaScript:
    $(document).ready(function(){
      $(".toggle_container").hide();
      $("h2.trigger").toggle(function(){
        $(this).addClass("active");
      }, function () {
        $(this).removeClass("active");
      });
     
      $("h2.trigger").click(function(){
        $(this).next(".toggle_container").slideToggle("slow,");
      });
    });

    The problem is that the initial call to toggle() is hiding any <h2> elements on the page which have a class of "trigger".
    This is actually what toggle() is meant to do - display or hide the matched elements.
    If you remove this, then your content will be visible again.

    If you want to add/remove a class to the <h2> elements depending on whether their next sibling is visible, you can do it using toggleClass():

    Code JavaScript:
    $(document).ready(function(){
      $(".toggle_container").hide();
     
      $("h2.trigger").click(function(){
        $(this).next(".toggle_container").slideToggle("slow,");
        $(this).toggleClass("active");
      });
    });;


Bookmarks

Posting Permissions

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