jQuery在页面刷新后工作
jQuery works after page refresh
我使用jQuery mash菜单插件,我有一个固定的菜单在我的页面顶部,但在响应我的固定菜单不设置为display:block
本身。页面刷新后,它被设置为display:block
,但如果我删除插件或插件的HTML结构,一切工作正常。我想问题是与mash菜单插件,但我必须使用这个插件。
我的固定菜单是如何工作的?
我的固定菜单默认情况下不出现,但如果我向下滚动到保留页面,它会设置display:block
。(just responsive <768px)
编辑:不只是固定菜单-回到顶部的菜单不工作在手机上
我JS$(window).load(function(){
if (!$(".hotel-search-box").length) {
return false; //Check if the element exist
}
$(window).scroll(function() {
if($(window).scrollTop() > $(".hotel-search-box").offset().top+$(".hotel-search-box").height()){
$(".sticky-checkin").fadeIn(500);
}else{
$(".sticky-checkin").fadeOut(500);
}
});
})
MASH PLUGİN JS
$('.mash-menu').mashableMenu({
separator : true, //-- Options (true) or (false). This option is used to show the vertical line between menu list items
ripple_effect : false, //-- Options (true) or (false). This option is used to on - off the google ripple effect on menu items. Which is shown on mouse click
search_bar_hide : false, //-- Options (true) or (false). This option is used to hide the search bar
top_fixed : false, //-- Options (true) or (false). This option is used to fixed the menu top of the screen. Note: If this option becomes true then the sticky_header option will not work
full_width : false, //-- Options (true) or (false). This option is used to make the menu full with
right_to_left : false, //-- Options (true) or (false). This option is used to align the menu items right to left side order
trigger : 'hover', //-- Options (click) or (hover). This option is used to showing the drop down on mouse click or mouse hover
/* VERTICAL TABS */
vertical_tabs_trigger : 'click', // Options (click) or (hover). This option is used to showing the vertical tabs on mouse click or mouse hover
vertical_tabs_effect_speed : 400, // Value in milliseconds. This option is used to change the vertical tabs showing or hiding speed
/* RESPONSIVE TABS */
//responsive_tabs_effect_speed : 200, // Value in milliseconds. This option is used to change the responsive tabs showing or hiding speed
/* DROP DOWN */
drop_down_effect_in_speed : 200, // Value in milliseconds. This options is used to change the drop downs showing speed
drop_down_effect_out_speed : 200, // Value in milliseconds. This option is used for change the drop downs hiding speed
drop_down_effect_in_delay : 200, // Value in milliseconds. This option is used to change the drop downs showing delay speed. It means drop down shows after some time
drop_down_effect_out_delay : 200, // Value in milliseconds. This option is used to change the drop downs hiding delay speed. It means drop down hides after some time
outside_close_dropDown : true, // Options (true) or (false). This option is used to hide the showing drop downs when user click outside the menu
/* STICKY HEADER */
mobile_search_bar_hide : false, //-- Options (true) or (false). This option is used to hide the search bar on mobile mode
mobile_sticky_header : false, //-- Options (true) or (false). This options is used to make the menu sticky on top of the screen on mobile mode
mobile_sticky_header_height : 100, //-- Value in milliseconds. This option is used to change the sticky header animation effect speed on mobile mode
/* MEDIA QUERY WIDTH */
media_query_max_width : 768 //-- This is media query max width in px unit. Which is Used for mobile screen. Don't change if you don't know about media query
});
点击演示地址
编辑:如果你检查一下响应(<768px),你会发现如果你向下滚动页面什么也没有发生,但如果你刷新页面并向下滚动,你会看到它的工作
只有在调整浏览器大小时才会出现问题。如果你以<768px打开页面,效果很好。onresize事件有问题
相关文章:
- 刷新后,setTimeout将工作或不工作
- .html()不会'页面更改或刷新时无法工作
- AngularJS控制器没有'第一次刷新页面后无法工作
- .addClass不工作(刷新时被删除)
- Javascript don'刷新页面后无法工作-为什么
- Kml层在刷新后工作正常,但给定typeError:无法读取属性getMap.第一次加载时
- jQuery AJAX刷新没有'不能在iPhone上工作
- Javascript在刷新后停止工作
- 页面刷新时脚本无法正常工作
- 为什么 jquery toggle() 方法在页面不刷新的情况下无法正常工作
- ngCookie在我刷新页面后无法正常工作
- Angular + requireJS:快速刷新页面会导致页面在 Chrome 中停止工作
- Jquery 日期选择器仅在页面刷新后工作
- 将公司名称绑定到更新面板中的下拉列表,自动完成文本框工作,但每次页面刷新时
- 防止刷新后返回不工作
- 轮播在初始重定向时中断,但在刷新时工作正常
- Javascript仅在第一次刷新后工作
- Javascript在页面刷新后工作,不知道解决方案
- JQuery 函数在页面加载时未触发,它仅在我刷新页面或再次重新访问同一页面后才能工作
- Rails 应用程序 - jQuery Document.ready在单击链接时不调用,但在新选项卡中打开或刷新时工作