Profile image
Tác giả: fcwordpress
Trang tin cá nhân | Bài đã đăng
Lượt xem

Hiện tại:
1h trước:
24h trước:
Tổng số:
Sử dụng sự kiện scrollTop để cố định thanh menus
Sunday, December 11, 2016 3:15
% of readers think this story is Fact. Add your two cents.
0

Chúng ta sẽ sử dụng sự kiện scroll và scrollTop của jquery và một chút css để làm việc này. Cụ thể như thế nào mời anh chị xem video sau:


Mã css:

.menus-scroll { position: fixed; top: 0; left: 0; max-width:100% !important; }

Mã jquery:

$(window).scroll(function(){ var wide = $(window).width(); var start = 200; if($(this).scrollTop()>=start){ $('.menutop12v2-wrapper').addClass('menus-scroll'); } if($(this).scrollTop()

BÌNH LUẬN

Lời bình của bạn
Question   Razz  Sad   Evil  Exclaim  Smile  Redface  Biggrin  Surprised  Eek   Confused   Cool  LOL   Mad   Twisted  Rolleyes   Wink  Idea  Arrow  Neutral  Cry   Mr. Green

Tin nổi bật trong ngày
Tin mới nhất

Register

Newsletter

Email this story
Share This Story:
Print this story
Email this story
Digg
Reddit
StumbleUpon
Share on Tumblr
GET ALERTS:

If you really want to ban this commenter, please write down the reason:

If you really want to disable all recommended stories, click on OK button. After that, you will be redirect to your options page.