PageSourceSearch

https://www.dover.gov.uk/NEW-Site-Elements/Scripts/Dropdown.js?version=200287&build=172167

js dover.gov.uk collected 2026-10-02 06:30:51 UTC 3,658 bytes, 121 lines download raw bytes

1// $(document).ready(function() {
2// 	$('.corona h2').each(function() {
3// 		var tis = $(this), state = false, answer = tis.next('div').slideUp();
4// 		tis.click(function() {
5// 			state = !state;
6// 			answer.slideToggle(state);
7// 			tis.toggleClass('active',state);
8// 		});
9// 	});
10// });
11
12$(document).ready(function () {
13
14  // select headings with class, and legacy classes
15  var $accorHeadings = $("h2.Drop, .accordion-container .accordion-heading :header");
16
17  // if selection is found
18  if ($accorHeadings.length) {
19    // for each heading
20    $accorHeadings.each(function (index, el) {
21      // cache the heading
22      var $heading = $(el);
23
24      var $headedContent;
25      var $carHeadedContent;
26
27      // handle legacy markup
28      if ($('.car-parks').length) {
29        // cache the sibling div
30        $carHeadedContent = $("div.slide-el");
31      } else {
32        $headedContent = $heading.next();
33      }
34
35      // if sibling div is found
36      if (($headedContent && $headedContent.length) || ($carHeadedContent && $carHeadedContent.length)) {
37        // add class to heading to remove pseudo element for existing state cue
38        $heading.addClass("is-accordion");
39
40        // create button, with content from heading, create button indicator, set variables for ids
41        var $btn = $("<button></button>").html($heading.html()),
42          uniqueHeadingId = "accordion-heading-" + index,
43          uniqueHeadedContentId = "accordion-content-" + index,
44          $btnIndicator = $("<span></span>");
45
46        // add attributes to button indicator
47        $btnIndicator.attr({
48          "aria-hidden": "true",
49          class: "accordion-indicator",
50        });
51
52        // add indicator to button
53        $btn.append($btnIndicator);
54
55        // set attributes to button
56        $btn.attr({
57          type: "button",
58          id: uniqueHeadingId,
59          class: "accordion-button",
60          "aria-expanded": "false",
61          "aria-controls": uniqueHeadedContentId,
62        });
63
64        if ($headedContent) {
65          // assign attributes to div
66          $headedContent.attr({
67            id: uniqueHeadedContentId,
68            "aria-labelledby": uniqueHeadingId,
69          });
70        }
71
72        if ($carHeadedContent) {
73          $carHeadedContent.attr({
74            id: uniqueHeadedContentId,
75            "aria-labelledby": uniqueHeadingId,
76          });
77        }
78
79        // add event listener
80        $btn.on("click", function () {
81          // preserve legacy styling
82          $heading.toggleClass("active");
83          // var height = $(this).css("height");
84          $heading.hasClass("active") ? openContainer($(this)) : closeContainer($(this));
85          // toggle opening and closing of content
86          if ($headedContent) {
87            $headedContent.slideToggle(function () {
88              $btn.attr("aria-expanded", function (index, value) {
89                return value == "false" ? "true" : "false";
90              });
91            });
92          }
93
94        });
95
96
97        function openContainer(obj) {
98          obj.closest(".car-parks__box").children(".slide-el").slideDown();
99          obj.closest(".car-parks__box").animate({
100            borderWidth: "8px"
101          });
102        }
103
104        function closeContainer(obj) {
105          obj.closest(".car-parks__box").children(".slide-el").slideUp();
106          obj.closest(".car-parks__box").animate({
107            borderWidth: "0px"
108          });
109        }
110
111        // replace heading inner html with button
112        $heading.html($btn);
113
114        // apply animation method
115        if ($headedContent) {
116          $headedContent.slideUp();
117        }
118      }
119    });
120  }
121});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.