Reputation: 5012
I am using jquery mobile for my application. I want a page should scroll down automatically when that page get load or call. But my problem is I want this for particular page. I use the code given below
$('div').live('pageshow',function(event, ui){
goto_bottom();
});
Function goto_bottom(); is use for scroll the page down. It is working for that page but it is working for other page too. Which I don't want. Is there any way to detect the page url and call it using that criteria.
Thanks in advance.
Upvotes: 3
Views: 397
Reputation: 895
Dima gave the most suitable answer.
Just to add, the page which you are navigating into is stored in the second property of the handler in ui.nextpage
.
$("#page").on( "pageshow", function( event, ui ) {
var currentPage = ui.nextPage;
});
Upvotes: 0
Reputation: 1316
You can use id of your page as a selector instead of div. When you use 'div' selector you bind your callback to pageshow event of all pages in your application
$('#your-page').on('pageshow',function(event, ui){
goto_bottom();
});
Upvotes: 4