page-init

jQuery mobile popup on pageinit

99封情书 提交于 2019-12-31 00:49:09
问题 I want a popup to open as soon as the page loads but seem to be getting stuck with the spinning wheel. Here is a fiddler to demonstrate the problem any help would be appreciated. http://jsfiddle.net/Ohpyx/UGfXG/ The code I'm using is: $(document).live('pageinit',function(event){ $('#popupBasic').popup('open'); })​ 回答1: This worked for me: $(document).on('pageinit', '.ui-page',function(event){ setTimeout(function () { $('#popupBasic').popup('open'); }, 0);//Note the comment below from @Taifun.

jQuery Mobile - binding to pageinit event

做~自己de王妃 提交于 2019-12-28 06:46:10
问题 I am trying to understand the following jQuery Mobile example. $( '#aboutPage' ).live( 'pageinit',function(event){ alert( 'This page was just enhanced by jQuery Mobile!' ); }); What is #aboutPage in this context? What is the object pageinit is binding to? 回答1: aboutPage should be the id of the page.(i.e.div with data-role="page" ). live() attaches the funcion you have defined which contains the alert to the pageinit event of aboutPage . pageinit is triggered on a page when the page is

How to use pageinit for multiple data-role=page in one html file

江枫思渺然 提交于 2019-12-24 00:36:20
问题 I have multiple pages in my one html file. I trying to implement the pageinit event handler on the second data-role="page". So I declared pageinit inside it's specific data-role="page". <div data-role="page" id="foo3" data-dom-cache="false"> <script> $(document).on('pageinit','#foo3' , function(){ abcsong_file_path = '/android_asset/www/audio/abcsong.mp3'; my_abc = new Media(abcsong_file_path); my_abc.play(); var i =0; var time; function my_loop(){ setTimeout(function (){ var my_alphabets = [

Why is 'pageinit' firing twice?

喜你入骨 提交于 2019-12-11 03:14:41
问题 Please could someone tell me why the pageinit is running twice? I had an issue where my listview items would be duplicated and by putting in an alert box I identified that it is because the pageinit is running twice. However, I can't see why... Here is my JS code: $(document).on('pageinit', '#searchPage', function(){ alert("This alert box runs twice!"); $.ajax({ dataType: "json", url: '../JS/food.json', success: function(result){ var output = ''; $.each(result, function(i, food){ output += '

ASP.Net - Page_Load and Page_Init get called on each button click?

十年热恋 提交于 2019-12-10 15:04:13
问题 So I have absolutely no logic in my code. I have the two methods Page_Init & Page_Load Both methods get called every time I click the button. It makes sense for Page_load to get called. But why does Page_Init get called every time? protected void Page_Init(Object sender, EventArgs e) { } protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click1(object sender, EventArgs e) { // Do something here } 回答1: I guess you are unaware of Page Life Cycle. Page_Init will

How to use pageinit correctly?

你。 提交于 2019-12-10 13:37:47
问题 I have a single file for each page and i am trying to implement the pageinit event handler on every page (I think what belongs strictly to one page, should be declared there) as shown below: <body> <div id="myPage" data-role="page"> <!-- Content here --> <script type="text/javascript"> $("#myPage").live('pageinit', function() { // do something here... }); </script> </div> </body> The event is bound properly to the page, so the code is executed but - now my problem - if i go to another page

jQuery mobile popup on pageinit

流过昼夜 提交于 2019-12-01 18:40:06
I want a popup to open as soon as the page loads but seem to be getting stuck with the spinning wheel. Here is a fiddler to demonstrate the problem any help would be appreciated. http://jsfiddle.net/Ohpyx/UGfXG/ The code I'm using is: $(document).live('pageinit',function(event){ $('#popupBasic').popup('open'); })​ This worked for me: $(document).on('pageinit', '.ui-page',function(event){ setTimeout(function () { $('#popupBasic').popup('open'); }, 0);//Note the comment below from @Taifun. })​ You had a race condition and this places the popup code at the end of the queue. Here is a demo: http:/

dynamically created radiobuttonlist

二次信任 提交于 2019-12-01 09:40:32
Have a master page. The content page has a list with hyperlinks containing request variables. You click on one of the links to go to the page containing the radiobuttonlist (maybe). First problem: When I get to the new page, I use one of the variables to determine whether to add a radiobuttonlist to a placeholder on the page. I tried to do it in page)_load but then couldn't get the values selected. When I played around doing it in preInit, the first time the page is there, I can't get to the page's controls. (Object reference not set to an instance of an object.) I think it has something to do

dynamically created radiobuttonlist

感情迁移 提交于 2019-12-01 08:57:40
问题 Have a master page. The content page has a list with hyperlinks containing request variables. You click on one of the links to go to the page containing the radiobuttonlist (maybe). First problem: When I get to the new page, I use one of the variables to determine whether to add a radiobuttonlist to a placeholder on the page. I tried to do it in page)_load but then couldn't get the values selected. When I played around doing it in preInit, the first time the page is there, I can't get to the

Check Session variable and Redirect to login page before page load

不羁岁月 提交于 2019-12-01 01:49:16
How can I check a variable and redirect to another page before the page loads using ASP.NET? I'm aware of the life cycle, and PageInit() sounds like it would be right, but I can't seem to find anywhere to put the code without and error within Visual Studio. I can't put the onpageinit="" within the first line of my page declaration. Am I suppose to put it somewhere different? My page declaration looks like: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dashboard.aspx.cs" Inherits="dashboard" MasterPageFile="~/Design.master" %> This is the code that I want to run on the page load: //