Tom Schreck
Tom Schreck

Reputation: 5287

ASP.Net MVC and jQuery Mobile page transitions

I'm developing an app where the client has a container div on their site and they use jQuery to retrieve my app and inject it into the container. My app is self contained as the html and javascript are all injected into client container. Each client has it's own css file so look and feel can change as needed by client. My app is ASP.Net MVC 4 and can be injected into a web page or a mobile app. I'm using HTML 5, css 3. I'm using ASP.Net MVC 4 to determine if the client is mobile or web and am loading jQuery Mobile if client is mobile.

So, since the app is self contained and I'm using jquery to load subsequent pages into a div as the user interacts with the app, how do i take advantage of jQuery Mobile's page transitions? I have to load subsequent content into a div using jQuery. I cannot do a complete page postback. I can't figure out how to do page transitions.

Thanks for your time.

Upvotes: 0

Views: 2741

Answers (1)

tpolyak
tpolyak

Reputation: 1239

Try multi-page apps: your file can contain multiple pages:

<div data-role="page" id="first">
...
</div>
<div data-role="page" id="second">
...
</div>

After you load additional pages and add them to DOM, then you call

$.mobile.changePage($("#third"));

More details about multi-page apps here: http://jquerymobile.com/test/docs/pages/multipage-template.html

Upvotes: 1

Related Questions