I am building a webapp using the jqm framework and I have been attempting to use the pageshow
function when including a jQuery widget, k3dcarousel. On the page in question, I have my script underneath the data-role="page"
div,
$("#page-about").live(
"pageshow",
function (event) {
$('#k3dCarousel_portrait').k3dCarousel();
}
);
It seems that I need to click on my link twice to get the JS function to load, which would make me think I am using this function wrong. Also, If I don't use the
$("#page-about").die();
function underneath the pageshow
function, the script will get loaded multiple times if I click back and then click on the link again.
Am I using the pageshow
logic wrong? Is there a better way to achieve what I am attempting to do: AJAX this page into my mobile framework.
I understand this is a rather specific question, but hopefully there is a generic answer to this, as it seems to me that this could happen to any widget.
Any help is greatly appreciated, I can paste more code if that helps.
Thank you for your time.