EliteHackersG
Ranking Optimization Wizard
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
In this tutorial, we are going to learn on How To Create Scrolling Menu. It will help the user to navigate the menu easily. And it will increase the menu usability.
This is a fixed position scrolling menu that we have right now. And, we added a jQuery effect to scrolling smoothly.
Menu HTML
This is our scrolling menu.
Also, this is our scrolling content.
And, this is our style.
jQuery Scrolling Effect
This script is used for our menu to have a smooth effect when the user scrolling the page.
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
Download
This is a fixed position scrolling menu that we have right now. And, we added a jQuery effect to scrolling smoothly.
Menu HTML
This is our scrolling menu.
- <div
id
=
"scrolling-menu"
>
- <div
id
=
"Deluxe"
>
Deluxe</
div
>
- <div
id
=
"Super"
>
Super Deluxe</
div
>
- <div
id
=
"Matrimonial"
>
Matrimonial Room</
div
>
- <div
id
=
"Junior"
>
Junior Suite</
div
>
- <div
id
=
"Executive"
>
Executive Suite</
div
>
- </
div
>
Also, this is our scrolling content.
- <div
id
=
"scroll-content"
>
- <div
id
=
"Deluxe-content"
>
- <h1
>
Deluxe</
h1
>
- This elegantly appointed room has 2 beds, a double bed and a single bed. It also comes with a writing desk and a coffee table set. The dimension of this room is 30 sqm. / 323 sqft.
- </
div
>
- <div
id
=
"Super-content"
>
- <h1
>
Super Deluxe</
h1
>
- The super deluxe rooms are also known as the Business Class guest room with 2 beds, a double bed and a single bed. Relax and unwind after a long day and enjoy the bathtub in the cozy room. The dimension of this room is 30 sqm. / 323 sqft.
- </
div
>
- <div
id
=
"Matrimonial-content"
>
- <h1
>
Matrimonial Room</
h1
>
- The spacious matrimonial room is similar to the deluxe room but with one king bed and a larger room area.
- </
div
>
- <div
id
=
"Junior-content"
>
- <h1
>
Junior Suite</
h1
>
- The junior suite is a one bedroom suite with a king bed and comes with spacious sitting room. It is furnished with a dining set for 4 guests, a coffee table with two armchairs and a writing desk. The one and only Junior Suite is located at the fourth floor. The dimension of this room is 48 sqm. / 517 sqft.
- </
div
>
- <div
id
=
"Executive-content"
>
- <h1
>
Executive Suite</
h1
>
- There are 4 executive suites, three of which are a 2 room suite, while the other is a 1 bedroom suite. Designed for informal meetings and entertaining guests, the suites have a separate sitting room with a comfortable sofa, armchair, desk and dining table. The dimension of this room is 64 sqm. / 689 sqft.
- </
div
>
- </
div
>
And, this is our style.
- <style type=
"text/css"
>
- #scrolling-menu
{
- position
:
fixed
;
- width
:
150px
;
- margin-top
:
10px
;
- }
- #scrolling-menu
div {
- padding
:
11px
;
- background
:
antiquewhite
;
- color
:
blue
;
- cursor
:
pointer
;
- border
:
blue
1px
solid
;
- }
- #scrolling-menu
div:
hover
{
- padding
:
11px
;
- margin-bottom
:
1px
;
- background
:
#C7B3B3
;
- color
:
red
;
- cursor
:
pointer
;
- border
:
red
1px
solid
;
- }
- #scroll-content
{
- border-left
:
#CCC
4px
solid
;
- margin-left
:
150px
;
- padding-left
:
60px
;
- color
:
black
;
- }
- #scroll-content
div {
- margin-bottom
:
60px
;
- }
- h1 {
- color
:
blue
;
- }
- h1:
hover
{
- color
:
red
;
- cursor
:
pointer
;
- }
- </style>
jQuery Scrolling Effect
This script is used for our menu to have a smooth effect when the user scrolling the page.
- <
script src=
"js/code_js.js"
></
script>
- <
script>
- $(
document)
.ready
(
function
(
)
{
- $(
window)
.scroll
(
function
(
e)
{
- if
(
$(
window)
.scrollTop
(
)
>
(
$(
'#scroll-content'
)
.height
(
)
-
$(
'#scrolling-menu'
)
.height
(
)
)
)
{
- var
scroll =
$(
'#scroll-content'
)
.height
(
)
-
$(
'#scrolling-menu'
)
.height
(
)
;
- $(
window)
.scrollTop
(
scroll)
;
- return
false
;
- }
- }
)
;
- $(
'#scrolling-menu div'
)
.click
(
function
(
)
{
- var
target =
$(
this
)
.attr
(
'id'
)
;
- $(
'html, body'
)
.animate
(
{
scrollTop:
$(
'#'
+
target+
'-content'
)
.offset
(
)
.top
}
,
1000
)
;
- }
)
;
- }
)
;
- </
script>
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
Download
You must upgrade your account or reply in the thread to view the hidden content.