我有一个必须在移动设备上正确显示的网页.为此,我在页面的头部加载了JQuery Mobile脚本.head标签看起来像这样:
<head>
<title>Page Title</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)
并在页面的body元素中使用data-role属性来显示内容.这些页面在移动设备上看起来相当不错,但即使请求来自非移动浏览器,它也会以类似的方式显示.
我想知道是否有人知道加载JQuery Mobile脚本的方法,只有当请求来自移动设备时.
到目前为止我所尝试的是使用检测我的用户代理的函数并加载脚本(如果它是移动设备):
function init() {
if(isMobile()) {
document.write('<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />');
document.write('<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>');
dcument.write('<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>');
}
}
function isMobile() {
if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/iPhone|iPad|iPod/i) || navigator.userAgent.match(/IEMobile/i))
return true;
return false;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Eclipse BPEL Designer插件创建服务编排,并且我自动生成的WSDL文件存在问题.
这是WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.invocation.import" xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" xmlns:wsdl="http://services.lolsystem.it" name="ImportOrchestration" targetNamespace="http://ws.invocation.import">
<plnk:partnerLinkType name="ImportType">
<plnk:role name="ImportRole" portType="wsdl:ImportServicePortType"/>
</plnk:partnerLinkType>
<import location="ImportModule.wsdl" namespace="http://services.italsystem.it"/>
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.invocation.import">
<element name="ImportOrchestrationRequest" type="tns:ImportOrchestrationReqType">
</element>
<element name="singleEntry">
<complexType>
<sequence>
<element minOccurs="0" name="name" nillable="true" type="string"/>
<element minOccurs="0" name="content" nillable="true" type="base64Binary"/>
</sequence>
</complexType>
</element>
<element name="ImportOrchestrationResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
<complexType name="ImportOrchestrationReqType">
<sequence minOccurs="1" maxOccurs="unbounded">
<element name="file" type="tns:SingleFile"></element>
</sequence>
</complexType>
<complexType name="SingleFile">
<sequence>
<element name="name" type="string"></element>
<element …Run Code Online (Sandbox Code Playgroud) 我尝试使用JQuery广告将图像加载到HTML元素中,使用图像属性来执行其他操作.我试图做的是这样的:
var img = new Image();
img.src = "icon.png";
var width = img.width;
var height = img.height;
$("#element").css("background-image", "url(" + img.src + ")");
//use width and height...
Run Code Online (Sandbox Code Playgroud)
它大部分时间都有效,但我发现有时"宽度"和"高度"设置为0.做一些搜索我发现图像加载是一个异步作业,所以碰巧我试图读取属性时它是仍未加载.我发现有一个onLoad事件可以用来在加载图像时指定一个回调函数.
我想知道这是否是做这些事情的最佳方式.例如,假设我只需要一些关于图像的信息,但我不需要显示它,我想管理那个信息客户端.我需要加载图片吗?是否有其他方式来获取此类信息?
javascript ×2
apache-ode ×1
axis2 ×1
bpel ×1
html ×1
image ×1
jquery ×1
mobile ×1
web-services ×1
wsdl ×1