<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
title
>Bootstrap 5 Scrollspy dispose() Method</
title
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1"
>
<
link
rel
=
"stylesheet"
href
=
<
script
src
=
</
script
>
<
script
src
=
</
script
>
<
script
src
=
</
script
>
</
head
>
<
body
data-spy
=
"scroll"
data-target
=
".navbar"
data-offset
=
"50"
>
<
h1
class
=
"text-success"
>
GeeksforGeeks
</
h1
>
<
h3
>Bootstrap 5 Scrollspy dispose() Method</
h3
>
<
nav
class="navbar navbar-expand-sm bg-success
navbar-dark fixed-top">
<
ul
class
=
"navbar-nav"
>
<
li
class
=
"nav-item"
>
<
a
class
=
"nav-link"
href
=
"#content1"
>
Home
</
a
>
</
li
>
<
li
class
=
"nav-item"
>
<
a
class
=
"nav-link"
href
=
"#content2"
>
Algo
</
a
>
</
li
>
<
li
class
=
"nav-item"
>
<
a
class
=
"nav-link"
href
=
"#content3"
>
DS
</
a
>
</
li
>
<
li
class
=
"nav-item dropdown"
>
<
a
class
=
"nav-link dropdown-toggle"
href
=
"#"
id
=
"navbardrop"
data-toggle
=
"dropdown"
>
Languages
</
a
>
<
div
class
=
"dropdown-menu"
>
<
a
class
=
"dropdown-item"
href
=
"#content4"
>
C
</
a
>
<
a
class
=
"dropdown-item"
href
=
"#content5"
>
C++
</
a
>
</
div
>
</
li
>
</
ul
>
</
nav
>
<
div
id
=
"content1"
class
=
"container-fluid bg-primary"
style
=
"height:250px; padding-top:80px;"
>
<
p
>A computer science portal for geeks</
p
>
</
div
>
<
div
id
=
"content2"
class
=
"container-fluid bg-light"
style
=
"height:250px; padding-top:80px;"
>
<
h1
>Algorithm Analysis</
h1
>
<
p
>A stepwise procedure to solve a problem</
p
>
</
div
>
<
div
id
=
"content3"
class
=
"container-fluid bg-warning"
style
=
"height:250px; padding-top:80px;"
>
<
h1
>Data Structure</
h1
>
<
p
>
Data structure is a particular way to
organizing the datain computer memory
so that it can be used efficiently.
</
p
>
</
div
>
<
div
id
=
"content4"
class
=
"container-fluid bg-info"
style
=
"height:250px; padding-top:80px;"
>
<
h1
>C Languages</
h1
>
<
p
>
C is a general-purpose, procedural computer
programming language used for operating
systems, libraries, games and other high
performance work.
</
p
>
</
div
>
<
div
id
=
"content5"
class
=
"container-fluid bg-secondary"
style
=
"height:250px; padding-top:80px;"
>
<
h1
>C++ Languages</
h1
>
<
p
>
C++ is an object-oriented programming
language, developed by Bjarne Stroustrup,
and is an extension of the C language. It is
therefore possible to code C++ in a "C style"
or "object-oriented style."
</
p
>
</
div
>
<
button
id
=
"disable-btn"
type
=
"button"
class
=
"btn btn-primary"
>
Disable Scrollspy
</
button
>
<
button
id
=
"enable-btn"
type
=
"button"
class
=
"btn btn-secondary"
>
Enable Scrollspy
</
button
>
<
script
>
$('#disable-btn').click(function () {
$('body').scrollspy('dispose');
});
$('#enable-btn').click(function () {
$('body').scrollspy({
target: '.navbar',
offset: 50
});
});
</
script
>
</
body
>
</
html
>