<!DOCTYPE html>
<
html
>
<
head
>
<
title
>
Load more function Example:2
</
title
>
<
script
src
=
</
script
>
<
script
src
=
</
script
>
<
style
>
h1 {
color: #3C8E3D;
}
.block {
display: none;
font-size: 20px;
}
#load {
font-size: 20px;
color: green;
}
</
style
>
</
head
>
<
body
>
<
h1
align
=
"center"
>
<
b
> GeeksforGeeks <
br
>
<
u
>Load more function</
u
>
</
b
>
</
h1
>
<
div
class
=
"container"
>
<
div
class
=
"block"
>
An array is a collection of items stored
at contiguous memory locations.The idea
is to store multiple items of the same
type together. This makes it easier to
calculate the position of each element
by simply adding an offset to a base
value, i.e., the memory location of the
first element of the array (generally
denoted by the name of the array).
</
div
>
<
div
class
=
"block"
>
The base value is index 0 and the
difference between the two indexes is
the offset. For simplicity, we can
think of an array as a fleet of stairs
where on each step is placed a value
(let’s say one of your friends). Here,
you can identify the location of any of
your friends by simply knowing the count
of the step they are on.
</
div
>
<
div
class
=
"block"
>
In C language, array has a fixed size
meaning once the size is given to it,
it cannot be changed i.e. you can’t
shrink it neither can you expand it.
The reason was that for expanding, if
we change the size we can’t be sure
( it’s not possible every time) that we
get the next memory location to us as free.
</
div
>
<
div
class
=
"block"
> <
br
>
Types of indexing in an array: <
br
>
0 (zero-based indexing) <
br
>
1 (one-based indexing) <
br
>
n (n-based indexing)
</
div
>
</
div
>
<
div
id
=
"load"
> <
b
> Load More </
b
></
div
>
<
script
>
$(document).ready(function () {
$(".block").slice(0, 1).show();
if ($(".block:hidden").length != 0) {
$("#load").show();
}
$("#load").on("click", function (e) {
e.preventDefault();
$(".block:hidden").slice(0, 1).slideDown();
if ($(".block:hidden").length == 0) {
$("#load").text("No More to view")
.fadOut("slow");
}
});
})
</
script
>
</
body
>
</
html
>