scrollspy.component.html 22.9 KB
Newer Older
Ooh-Ao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
<app-page-header
  title="Scrollspy"
  title1="Scrollspy"
  activeitem="Elements"
></app-page-header>

<!-- Start::row-1 -->
<div class="grid grid-cols-12 gap-6">
  <div class="col-span-12 xxl:col-span-6">
    <div class="box">
      <div class="box-header">
        <h5 class="box-title">Basic Scrollspy</h5>
      </div>
      <div
        id="scrollspy-scrollable-parent-1"
        #scrollspy
        class="max-h-[340px] overflow-y-auto"
      >
        <div class="box-body">
          <header
            class="sticky top-0 inset-x-0 flex flex-wrap sm:justify-start sm:flex-nowrap z-40 w-full bg-white text-sm dark:bg-bgdark"
          >
            <nav
              class="w-full mx-auto sm:flex sm:items-center sm:justify-between"
              aria-label="Global"
            >
              <div class="flex items-center justify-between">
                <a
                  class="flex-none text-xl font-semibold dark:text-white"
                  href="javascript:void(0);"
                  >Brand</a
                >
                <div class="sm:hidden">
                  <button
                    type="button"
                    class="hs-collapse-toggle p-2 inline-flex justify-center items-center gap-2 rounded-md border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:outline-none focus:ring-0 focus:ring-offset-0 focus:ring-offset-white focus:ring-primary transition-all text-sm dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
                    data-hs-collapse="#navbar-collapse-basic"
                    aria-controls="navbar-collapse-basic"
                    aria-label="Toggle navigation"
                  >
                    <svg
                      class="hs-collapse-open:hidden w-4 h-4"
                      width="16"
                      height="16"
                      fill="currentColor"
                      viewBox="0 0 16 16"
                    >
                      <path
                        fill-rule="evenodd"
                        d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"
                      ></path>
                    </svg>
                    <svg
                      class="hs-collapse-open:block hidden w-4 h-4"
                      width="16"
                      height="16"
                      fill="currentColor"
                      viewBox="0 0 16 16"
                    >
                      <path
                        d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
                      ></path>
                    </svg>
                  </button>
                </div>
              </div>
              <div
                id="navbar-collapse-basic"
                class="hidden overflow-hidden transition-all duration-300 basis-full grow sm:block"
              >
                <div
                  data-hs-scrollspy="#scrollspy-1"
                  data-hs-scrollspy-offset="70"
                  data-hs-scrollspy-scrollable-parent="#scrollspy-scrollable-parent-1"
                  class="flex flex-col gap-5 mt-5 sm:flex-row sm:items-center sm:justify-end sm:mt-0 ltr:sm:pl-5 rtl:pr-5"
                >
                  <a
                    (click)="scroll(first, -1, 0)"
                    [class.active]="activeDropdownIndex === 0"
                    class="text-sm text-gray-700 leading-6 hover:text-gray-500 dark:text-white/70 dark:hover:text-white hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                    >First</a
                  >
                  <a
                    (click)="scroll(second, -1, 1)"
                    [class.active]="activeDropdownIndex === 1"
                    class="text-sm text-gray-700 leading-6 hover:text-gray-500 dark:text-white/70 dark:hover:text-white hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                    >Second</a
                  >

                  <div class="hs-dropdown relative inline-flex">
                    <button
                      id="hs-dropdown-basic"
                      (click)="toggleDropdown()"
                      [class.active]="isDropdownOpen"
                      type="button"
                      class="hs-mega-menu-toggle group hs-scrollspy-active:text-primary mb-3 sm:mb-0 dark:hs-scrollspy-active:text-primary inline-flex justify-center items-center gap-2 text-sm text-gray-700 leading-6 hover:text-gray-500 dark:text-white/70 dark:hover:text-white"
                    >
                      Dropdown
                      <svg
                        class="hs-scrollspy-active:stroke-primary ltr:ml-2 rtl:mr-2 w-2.5 h-2.5 stroke-gray-500 dark:stroke-white/70"
                        width="16"
                        height="16"
                        viewBox="0 0 16 16"
                        fill="none"
                        xmlns="http://www.w3.org/2000/svg"
                      >
                        <path
                          d="M2 5L8.16086 10.6869C8.35239 10.8637 8.64761 10.8637 8.83914 10.6869L15 5"
                          stroke="currentColor"
                          stroke-width="2"
                          stroke-linecap="round"
                        ></path>
                      </svg>
                    </button>

                    <div
                      class="hs-dropdown-menu transition-[opacity,margin] duration hs-dropdown-open:opacity-100 opacity-0 w-56 hidden z-10 mt-2 min-w-[15rem] bg-white shadow-md rounded-lg p-2 dark:bg-gray-800 dark:border dark:border-gray-700 dark:divide-gray-700"
                      aria-labelledby="hs-dropdown-basic"
                    >
                      <a
                        class="flex items-center gap-x-3.5 py-2 px-3 rounded-md text-sm text-gray-800 hover:bg-gray-100 focus:ring-2 focus:ring-blue-500 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-300"
                        (click)="scroll(third, -1, 2)"
                        [class.active]="activeDropdownIndex === 2"
                      >
                        Third
                      </a>
                      <a
                        class="flex items-center gap-x-3.5 py-2 px-3 rounded-md text-sm text-gray-800 hover:bg-gray-100 focus:ring-2 focus:ring-blue-500 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-300"
                        (click)="scroll(fourth, -1, 3)"
                        [class.active]="activeDropdownIndex === 3"
                      >
                        Fourth
                      </a>
                      <a
                        class="flex items-center gap-x-3.5 py-2 px-3 rounded-md text-sm text-gray-800 hover:bg-gray-100 focus:ring-2 focus:ring-blue-500 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-gray-300"
                        (click)="scroll(fifth, -1, 4)"
                        [class.active]="activeDropdownIndex === 4"
                      >
                        Fifth
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </nav>
          </header>

          <div id="scrollspy-1" class="mt-3 space-y-4">
            <div id="first" #first>
              <h3 class="text-lg font-semibold dark:text-white">First</h3>
              <p
                class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
              >
                This is some placeholder content for the scrollspy page. Note
                that as you scroll down the page, the appropriate navigation
                link is highlighted. It's repeated throughout the component
                example. We keep adding some more example copy here to emphasize
                the scrolling and highlighting.
              </p>
            </div>

            <div id="second" #second>
              <h3 class="text-lg font-semibold dark:text-white">Second</h3>
              <p
                class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
              >
                This is some placeholder content for the scrollspy page. Note
                that as you scroll down the page, the appropriate navigation
                link is highlighted. It's repeated throughout the component
                example. We keep adding some more example copy here to emphasize
                the scrolling and highlighting.
              </p>
            </div>

            <div id="third" #third>
              <h3 class="text-lg font-semibold dark:text-white">Third</h3>
              <p
                class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
              >
                This is some placeholder content for the scrollspy page. Note
                that as you scroll down the page, the appropriate navigation
                link is highlighted. It's repeated throughout the component
                example. We keep adding some more example copy here to emphasize
                the scrolling and highlighting.
              </p>
            </div>

            <div id="fourth" #fourth>
              <h3 class="text-lg font-semibold dark:text-white">Fourth</h3>
              <p
                class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
              >
                This is some placeholder content for the scrollspy page. Note
                that as you scroll down the page, the appropriate navigation
                link is highlighted. It's repeated throughout the component
                example. We keep adding some more example copy here to emphasize
                the scrolling and highlighting.
              </p>
            </div>

            <div id="fifth" #fifth>
              <h3 class="text-lg font-semibold dark:text-white">Fifth</h3>
              <p
                class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
              >
                This is some placeholder content for the scrollspy page. Note
                that as you scroll down the page, the appropriate navigation
                link is highlighted. It's repeated throughout the component
                example. We keep adding some more example copy here to emphasize
                the scrolling and highlighting.
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="col-span-12 xxl:col-span-6">
    <div class="box">
      <div class="box-header">
        <h5 class="box-title">Nested Scrollspy</h5>
      </div>
      <div
        id="scrollspy-scrollable-parent-2"
        class="max-h-[400px] overflow-y-auto"
      >
        <div class="box-body">
          <div class="grid grid-cols-5">
            <div class="col-span-12 sm:col-span-1">
              <h2 class="text-xl font-medium dark:text-white">Navbar</h2>
              <ul
                class="sticky top-0"
                data-hs-scrollspy="#scrollspy-2"
                data-hs-scrollspy-scrollable-parent="#scrollspy-scrollable-parent-2"
              >
                <li data-hs-scrollspy-group="">
                  <a
                    (click)="Nestedscroll(item1, 0)"
                    [class.active]="activeButtonIndex1 === 0"
                    class="block py-0.5 text-sm font-medium leading-6 text-slate-700 hover:text-slate-900 dark:text-white dark:hover:text-white/70 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary active"
                    >Item 1</a
                  >
                  <ul>
                    <li class="ltr:ml-4 rtl:mr-4">
                      <a
                        (click)="Nestedscroll(item2, -1, 1)"
                        [class.active]="activeDropdownIndex1 === 1"
                        class="group flex items-start gap-x-2 py-0.5 text-sm text-gray-700 leading-6 hover:text-gray-800 dark:text-white/70 dark:hover:text-gray-300 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary active"
                      >
                        <svg
                          class="w-2 h-6 text-gray-400 overflow-visible group-hover:text-gray-600 dark:text-white dark:group-hover:text-white/70 rtl:rotate-180"
                          width="16"
                          height="16"
                          viewBox="0 0 16 16"
                          fill="none"
                          xmlns="http://www.w3.org/2000/svg"
                        >
                          <path
                            d="M5 2L10.6464 7.64645C10.8417 7.84171 10.8417 8.15829 10.6464 8.35355L5 14"
                            stroke="currentColor"
                            stroke-width="2"
                            stroke-linecap="round"
                          ></path>
                        </svg>
                        Item 1-1
                      </a>
                    </li>
                    <li class="ltr:ml-4 rtl:mr-4">
                      <a
                        (click)="Nestedscroll(item3, -1, 2)"
                        [class.active]="activeDropdownIndex1 === 2"
                        class="group flex items-start gap-x-2 py-0.5 text-sm text-gray-700 leading-6 hover:text-gray-800 dark:text-white/70 dark:hover:text-gray-300 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                      >
                        <svg
                          class="w-2 h-6 text-gray-400 overflow-visible group-hover:text-gray-600 dark:text-white dark:group-hover:text-white/70 rtl:rotate-180"
                          width="16"
                          height="16"
                          viewBox="0 0 16 16"
                          fill="none"
                          xmlns="http://www.w3.org/2000/svg"
                        >
                          <path
                            d="M5 2L10.6464 7.64645C10.8417 7.84171 10.8417 8.15829 10.6464 8.35355L5 14"
                            stroke="currentColor"
                            stroke-width="2"
                            stroke-linecap="round"
                          ></path>
                        </svg>
                        Item 1-2
                      </a>
                    </li>
                  </ul>
                </li>
                <li>
                  <a
                    (click)="Nestedscroll(item4, 3)"
                    [class.active]="activeButtonIndex1 === 3"
                    class="block py-0.5 text-sm font-medium leading-6 text-slate-700 hover:text-slate-900 dark:text-white dark:hover:text-white/70 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                    >Item 2</a
                  >
                </li>
                <li data-hs-scrollspy-group="">
                  <a
                    (click)="Nestedscroll(item5, 4)"
                    [class.active]="activeButtonIndex1 === 4"
                    class="block py-0.5 text-sm font-medium leading-6 text-slate-700 hover:text-slate-900 dark:text-white dark:hover:text-white/70 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                    >Item 3</a
                  >
                  <ul>
                    <li class="ltr:ml-4 rtl:mr-4">
                      <a
                        (click)="Nestedscroll(item6, -1, 5)"
                        [class.active]="activeDropdownIndex1 === 5"
                        class="group flex items-start gap-x-2 py-0.5 text-sm text-gray-700 leading-6 hover:text-gray-800 dark:text-white/70 dark:hover:text-gray-300 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                      >
                        <svg
                          class="w-2 h-6 text-gray-400 overflow-visible group-hover:text-gray-600 dark:text-white dark:group-hover:text-white/70 rtl:rotate-180"
                          width="16"
                          height="16"
                          viewBox="0 0 16 16"
                          fill="none"
                          xmlns="http://www.w3.org/2000/svg"
                        >
                          <path
                            d="M5 2L10.6464 7.64645C10.8417 7.84171 10.8417 8.15829 10.6464 8.35355L5 14"
                            stroke="currentColor"
                            stroke-width="2"
                            stroke-linecap="round"
                          ></path>
                        </svg>
                        Item 3-1
                      </a>
                    </li>
                    <li class="ltr:ml-4 rtl:mr-4">
                      <a
                        (click)="Nestedscroll(item7, -1, 6)"
                        [class.active]="activeDropdownIndex1 === 6"
                        class="group flex items-start gap-x-2 py-0.5 text-sm text-gray-700 leading-6 hover:text-gray-800 dark:text-white/70 dark:hover:text-gray-300 hs-scrollspy-active:text-primary dark:hs-scrollspy-active:text-primary"
                      >
                        <svg
                          class="w-2 h-6 text-gray-400 overflow-visible group-hover:text-gray-600 dark:text-white dark:group-hover:text-white/70 rtl:rotate-180"
                          width="16"
                          height="16"
                          viewBox="0 0 16 16"
                          fill="none"
                          xmlns="http://www.w3.org/2000/svg"
                        >
                          <path
                            d="M5 2L10.6464 7.64645C10.8417 7.84171 10.8417 8.15829 10.6464 8.35355L5 14"
                            stroke="currentColor"
                            stroke-width="2"
                            stroke-linecap="round"
                          ></path>
                        </svg>
                        Item 3-2
                      </a>
                    </li>
                  </ul>
                </li>
              </ul>
            </div>

            <div class="col-span-12 sm:col-span-4">
              <div id="scrollspy-2" class="space-y-4">
                <div id="item-1" #item1>
                  <h3 class="text-lg font-semibold dark:text-white">Item 1</h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-1-1" #item2>
                  <h3 class="text-lg font-semibold dark:text-white">
                    Item 1-1
                  </h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-1-2" #item3>
                  <h3 class="text-lg font-semibold dark:text-white">
                    Item 1-2
                  </h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-2" #item4>
                  <h3 class="text-lg font-semibold dark:text-white">Item 2</h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-3" #item5>
                  <h3 class="text-lg font-semibold dark:text-white">Item 3</h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-3-1" #item6>
                  <h3 class="text-lg font-semibold dark:text-white">
                    Item 3-1
                  </h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>

                <div id="item-3-2" #item7>
                  <h3 class="text-lg font-semibold dark:text-white">
                    Item 3-2
                  </h3>
                  <p
                    class="mt-1 text-sm leading-6 text-gray-600 dark:text-white/70"
                  >
                    This is some placeholder content for the scrollspy page.
                    Note that as you scroll down the page, the appropriate
                    navigation link is highlighted. It's repeated throughout the
                    component example. We keep adding some more example copy
                    here to emphasize the scrolling and highlighting.
                  </p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- End::row-1 -->