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

问题描述

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

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



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

解决方案

看看



这是语法:

  $('#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”每次发生事件,不仅仅是刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 09:47