jquerymobile changepage 无法加载外部js文件解决办法

"

jQuery Mobile does not pull the whole page into the dom, it grabs the first data-role="page"element and its descendants and pulls that into the current dom.

So any scripts in the <head> of the document will not be included.

I generally put all the functional JavaScript for my site on the index page and then when external pages are loaded into the dom they can benefit from the already loaded scripts.

Also, you can place JavaScript code inside the data-role="page" element and it will be included when jQuery Mobile does its AJAX load of the page.

UPDATE

A good system for this is to put all of your JS into an include file and include it on each page of the site. It will be ignored if pages are brought into the DOM by AJAX, but if someone refreshes somewhere in your site, the JS will be available.

"

基本思想就是把<script src="***.js"></script>,放到body标签里,jquery.mobile.changepage()在加载页面的时候,就会把外部文件加载近来

用location.href = "***.html",可以加载外部js文件

原文链接:http://stackoverflow.com/questions/7449402/jquery-mobile-mobile-changepage-not-loading-external-js-files

转载于:https://www.cnblogs.com/xuedong09/archive/2013/02/01/2889148.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值