Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:37:14+00:00 2026-06-05T16:37:14+00:00

Hey its really hard to define an exact title for my problem. I am

  • 0

Hey its really hard to define an exact title for my problem.

I am using jQuery Accordions in my side with the years between 2008 and 2012. Inside these accordions are dates with a hyperlink. If you press any link an ajax get call will follow and append the result into a div container.

If I click the next link the previous one fade out and new div fade in.

Everything works like a charm excpect if I change between 2012 and 2011. Then my last opened div container in 2012 wont fade out.

This is my JS Code:

var tempDiv = '';
//Auswahl Jahr zum Anzeigen von Presseartikeln
$("#select_media").live("click", function() {
    var currentPos = $(this).data("pos");
    var currentDiv = $(this).data("div");

    alert(tempDiv);
    $("#" + tempDiv).fadeOut();
    tempDiv = currentDiv;

    $.ajax({
        url: 'edit.php?action=media_select&pos=' + currentPos,
        type: 'GET',
        dataType: 'html',
        success: function (select) {
            $("#" + currentDiv).html(select);
            $('#myGallery').galleryView();
            $("#" + currentDiv).fadeIn();
        }
    });
    return false;
});

The source Code of media_select is not important all you need to know is that there is an unordered list full of images as response.

This is my Accordion Code:

$date = getdate();
        $year = $date['year'];

        for ($i=$year; $i>=2008; $i--) {
            $getID = array();
            $getDate = array();
            $getTitle = array();
            $string = array();

            echo '<h3><a href="#" class="media_year_click">'.$i.'</a></h3>
            <div>';
            $sql = "SELECT 
                        ID,
                        DATE_FORMAT(Date, '%d.%m.%Y') AS Date_media,
                        Title
                    FROM 
                        Media
                    WHERE
                        YEAR(Date) = '".mysqli_real_escape_string($db, $i)."'
                    ORDER BY 
                        Date ASC
                    ";

            if (!$result = $db->query($sql)) {
                echo 'Datenbankfehler\n';
                echo $db->error;
            }

            $j = 0;
            while ($row = $result->fetch_assoc()) {
                $getID[$j] = $row['ID'];
                $getDate[$j] = $row['Date_media'];
                $getTitle[$j] = $row['Title'];
                $j++;
            }

            $result->close();

            //Ausgabe
            if (count($getID) == '0') {
                echo 'Kein Eintrag vorhanden';
            } else {
                echo '<ul id="media_no_point">';
                for($k = 0; $k < count($getID); $k++) {
                    $unique_id = '';
                    $string = explode(".", $getDate[$k]);
                    //Fix wenn Datum Tag 0 am Anfang enthält (wird nicht korrekt an JS übergeben)
                    //05032012 = 5032012 in JS
                    if ($string[0] < 10) {
                        $string[0] = mb_substr($string[0], 1);
                        $unique_id .= $string[0];
                    } else $unique_id .= $string[0];
                    $unique_id .= $string[1];
                    $unique_id .= $string[2];
                    echo '<li><a href="#" data-pos="'.$getID[$k].'" data-div="'.$unique_id.'" id="select_media">'.$getDate[$k].' - '.$getTitle[$k].'</a>
                        <div id="'.$unique_id.'" class="pictures"></div></li>';
                }
                echo '</ul>';
            }
            echo '</div>';
        }

If you dont know what I mean visit my site and click one link in year 2012 and then go to 2011 click the link and go back to 2012. There should be no image gallery.
Inserted alert() to show which div id is set as temp and its showing up the correct id. But the fade out is not working in closed accordion tab.

Edit: So it seems like I cant take any changes of the content in closed Accordion tabs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:37:15+00:00Added an answer on June 5, 2026 at 4:37 pm

    Fixed this issue. Added following code:

    $("#media_accordion").accordion({
        autoHeight: false,
        navigation: true,
        //Everytime a new tab is clicked hide previous div container    
        change: function(event, ui) {
            $("#" + tempDiv).hide();
        }
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I've tried to update jQuery to its latest version on a system I'm
Hey, everyone. I couldn't find anything Googling this problem, and I've found really good
Hey everybody, Im really confused about this problem. Ill try to describe it: The
Hey guys I'm a noob to jquery and I've heard it's okay to mix
Hey, I've been battling with PHP all morning and it's now really starting to
hey guys im really frustrated im looking for a way to retrieve back my
Hey guys I'm trying to do something really simple.. I'm checking a data column
hey guys, this might be really stupid, but hopefully someone can help. I'm trying
Hey SO, so I've got a custom control in Silverlight. Doesn't really matter what
Hey, I was just writing another basic script for my JS & jQuery practice,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.