如何使jquery移动“pagebeforeshow”每次发生事件,不仅仅是刷新 [英] how can I make jquery mobile "pagebeforeshow" event fire every time, not just on refresh

查看:143
本文介绍了如何使jquery移动“pagebeforeshow”每次发生事件,不仅仅是刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $( 'div:jqmData(role =page)')。live('pagebeforeshow',function(){
$(#apply_btn)hide()
});

我的问题是,只有当页面刷新时才会触发该事件,而不是在到达该页面时



我已经尝试使用pageshow事件和pageinit事件,但是只有刷新页面时才会触发。

解决方案

看看 http://jquerymobile.com/demos/1.1.0/docs/api/events.html



这是语法:

  $('#yourPage').live('pagebeforeshow',function(event){
$(# uniqueButtonId)。hide();
});

祝你好运


I have a jquery mobile page that uses the following code to hide a button when the page is accessed.

$('div:jqmData(role="page")').live('pagebeforeshow',function(){
  $("#apply_btn").hide()
});

My problem is that the event only fires when the page is refreshed and not when arriving at the page from somewhere else in the site.

I have tried using the "pageshow" event and the "pageinit" event but it still only fires when the page is refreshed.

解决方案

Have a look at http://jquerymobile.com/demos/1.1.0/docs/api/events.html

This is the syntax:

$( '#yourPage' ).live( 'pagebeforeshow',function(event){
    $("#uniqueButtonId").hide();
});

Good Luck

这篇关于如何使jquery移动“pagebeforeshow”每次发生事件,不仅仅是刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆