Lượt xem | |
Hiện tại: | |
1h trước: | |
24h trước: | |
Tổng số: |
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()2016-12-11 02:13:03
Nguồn: http://fcwordpress.net/su-dung-su-kien-scrolltop-de-co-dinh-thanh-menus.html