mirror of
https://github.com/TomHodson/tomhodson.github.com.git
synced 2025-06-26 10:01:18 +02:00
17 lines
545 B
JavaScript
17 lines
545 B
JavaScript
$(".header").click(function () {
|
|
|
|
$header = $(this);
|
|
//getting the next element
|
|
$content = $header.next();
|
|
//open up the content needed - toggle the slide- if visible, slide up, if not slidedown.
|
|
$content.slideToggle(500, function () {
|
|
//execute this after slideToggle is done
|
|
//change text of header based on visibility of content div
|
|
$header.text(function () {
|
|
//change text based on condition
|
|
return $content.is(":visible") ? "Collapse" : "Expand";
|
|
});
|
|
});
|
|
|
|
});
|