+ Reply to Thread
Results 1 to 3 of 3

Thread: jQuery collapsible divs

  1. #1
    Shadow121's Avatar
    Shadow121 is offline x10 Lieutenant Shadow121 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Centerville
    Posts
    455

    jQuery collapsible divs

    I've posted this elsewhere but I got no help >.>;

    I have a system for it set-up on my site and it works fine on the main page but when I go to like /members/ or /ucp/ it stops working and reverts to the old images that were used. Any help? and Yes I've changed them.

    Or not...?
    PHP Code:
    <?php
    header
    ("Content-Type: application/javascript; charset=UTF-8");
    require(
    "../configuration.db.php");
    ?>
    $(document).ready(function() {
    <?php
    foreach($_SESSION as $key => $value){
    ?>
    //alert('<?=$key?><?=$value?>');
    <?
    if($value == 'Disabled'){
    ?>
    $("#<?=$key?>").toggle();
    document.<?=$key?>_Click.src = '<?=SITE_LINK?>img/Icons/show.png';
    <?php
    }else{
    ?>
    $("#<?=$key?>").toggle();
    document.<?=$key?>_Click.src = '<?=SITE_LINK?>img/Icons/hide.png';
    <?php
    }
    }
    ?>
    <?php
        $getBlocks 
    $db->dbQuery("SELECT * FROM `".DB_PREFIX."blocks` WHERE `side` = 'left' OR `side` = 'right';");
        while(
    $getBlks $db->dbFetch($getBlocks)){
    ?>
    $("#<?=$Functions->replaceSpaces($getBlks->title)?>_Click").click(function() {
    $("#<?=$Functions->replaceSpaces($getBlks->title)?>").slideToggle("normal");
    if(document.<?=$Functions->replaceSpaces($getBlks->title)?>_Click.src == '<?=SITE_LINK?>img/Icons/show.png'){
        document.<?=$Functions->replaceSpaces($getBlks->title)?>_Click.src = '<?=SITE_LINK?>img/Icons/hide.png';
        <?php
        $_SESSION
    [$Functions->replaceSpaces($getBlks->title)] = "Enabled";
        
    ?>
    }else{
        document.<?=$Functions->replaceSpaces($getBlks->title)?>_Click.src = '<?=SITE_LINK?>img/Icons/show.png';
        <?php
        $_SESSION
    [$Functions->replaceSpaces($getBlks->title)] = "Disabled";
        
    ?>
    }
    });
    <?php
    }
    ?>
    /*
    REGULAR CONTENT FRONT PAGE
    */
    $("#Greetings_Content_Click").click(function() {
    $("#Greetings_Content").slideToggle("normal");
    if(document.Greetings_Content_Click.src == '<?=SITE_LINK?>img/Icons/show.png'){
        document.Greetings_Content_Click.src = '<?=SITE_LINK?>img/Icons/hide.png';
        <?php
        $_SESSION
    ['Greetings_Content'] = "Enabled";
        
    ?>
    }else{
        document.Greetings_Content_Click.src = '<?=SITE_LINK?>img/Icons/show.png';
        <?php
        $_SESSION
    ['Greetings_Content'] = "Disabled";
        
    ?>
    }
    });
    $("#Whats_In_Store_Click").click(function() {
    $("#Whats_In_Store").slideToggle("normal");
    if(document.Whats_In_Store_Click.src == '<?=SITE_LINK?>img/Icons/show.png'){
        document.Whats_In_Store_Click.src = '<?=SITE_LINK?>img/Icons/hide.png';
        <?php
        $_SESSION
    ['Whats_In_Store'] = "Enabled";
        
    ?>
    }else{
        document.Whats_In_Store_Click.src = '<?=SITE_LINK?>img/Icons/show.png';
        <?php
        $_SESSION
    ['Whats_In_Store'] = "Disabled";
        
    ?>
    }
    });
    });
    That is my code. ._. Its working on /home/ and / but no where else.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: jQuery collapsible divs

    In your post, it's not at all clear what's going wrong, what you've done to try to fix it and what the code is supposed to do. Read "How To Ask Questions The Smart Way".

    Quote Originally Posted by Shadow121 View Post
    I've posted this elsewhere but I got no help >.>;

    I have a system for it set-up on my site and it works fine
    What works fine? Based on what you say next, I assume you mean you're getting the images you want. If this is the case and the problem is that you're seeing the wrong images on some pages, then your post title ("jQuery collapsible divs") is misleading & immaterial.

    Quote Originally Posted by Shadow121 View Post
    on the main page but when I go to like /members/ or /ucp/ it stops working and reverts to the old images that were used. Any help? and Yes I've changed them.
    Changed what?

    Quote Originally Posted by Shadow121 View Post
    Or not...?
    Does "Or not...?" mean you're not sure you "change them"?

    When you post code, post a minimal test case. This means it includes all necessary lines but no more. It should be complete & concise.

    Quote Originally Posted by Shadow121 View Post
    PHP Code:
    ...
    document.<?=$key?>_Click.src = '<?=SITE_LINK?>img/Icons/show.png';
    ...
    Is "SITE_LINK" a defined constant? What's its value?

  3. #3
    Shadow121's Avatar
    Shadow121 is offline x10 Lieutenant Shadow121 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    Centerville
    Posts
    455

    Re: jQuery collapsible divs

    How about I don't take a look at that link.

    "or not" I forgot to remove when I was editing the previous post and it was working with cookies. But I swapped it over to sessions.

    SITE_LINK is defined in configuration.db.php

    "Changed what"? I changed over the image links and such things so that it would not revert to the old ones but still manages to go back to them for no reason.

    and works fine as in it expands / collapses but it screws up when going to a different area of the website.
    Last edited by Shadow121; 12-14-2008 at 04:11 PM.

+ Reply to Thread

Similar Threads

  1. Need help with divs :/
    By galaxyAbstractor in forum Graphics & Webdesign
    Replies: 0
    Last Post: 08-15-2008, 12:16 PM
  2. My Draggable Divs Script
    By VPmase in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 04-13-2008, 12:58 PM
  3. Mysterious space between DIVs
    By ThePaintGuru in forum Graphics & Webdesign
    Replies: 4
    Last Post: 03-29-2008, 10:58 PM
  4. I require your help with divs!
    By randomize in forum Scripts & 3rd Party Apps
    Replies: 6
    Last Post: 07-05-2006, 03:19 PM
  5. Yay! DIVS! :D
    By Conor in forum Graphics & Webdesign
    Replies: 10
    Last Post: 09-24-2005, 07:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers