我第一次使用jQuery-Mobile,我不知道如何在ios中使用我的项目。iOS中的移动jQuery - 如何获取UIWebView中的元素位置?
我必须导入哪个文件?在http://jquerymobile.com/网站上,我下载了jquery.mobile-1.0b3.js和jquery.mobile-1.0.min.js。我使用哪个?
这是我的代码。
NSString *path = [[NSBundle mainBundle] pathForResource:@"jquery.mobile-1.0b3" ofType:@"js"];
NSString *jsCode = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
[self stringByEvaluatingJavaScriptFromString:jsCode];
这是正确的?
而我想获得指定的元素。在jQuery中,有一个函数 - '.position' 但手机jquery支持这个功能吗?我怎么能够?
NSString *code = @"var p=$('p:first'); var pos=p.position();"
NSLog(@"%@", [webView stringByEvaluatingJavaScriptFromString:@"position.left"]);
请帮帮我。
在此先感谢。