我正在使用Highcharts和jQuery Mobile.
我在jQM data-role="content"容器中绘制了一个区域图,在该容器中我有以下div:
<div style="padding-top: 5px; padding-bottom: 10px; position: relative; width: 100%;">
<div id="hg_graph" style="width: 100%"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的高图图是从他们的一个示例中获取的基本图,其中我没有设置图表width属性.
在第一次加载时,图形超出了包含div的宽度,但是当我调整浏览器大小时,它会捕捉到适当的宽度.
我怎样才能使它的宽度在第一页加载时正确,而不仅仅是调整大小?
我已经回顾了关于堆栈溢出的类似帖子,但没有一个解决方案似乎有效.
更新
我发现问题在于,<rect>Highcharts 动态生成的标签在页面加载时占据了浏览器窗口的全宽,而根本没有从容器div宽度中获取它.这是我检查时生成的html:
<rect rx="5" ry="5" fill="#FFFFFF" x="0" y="0" **width="1920"** height="200"></rect>
我试图在JSFiddle中重现,但它似乎在那里工作正常,这真的让我难过.这是我的JSFiddle代码:http://jsfiddle.net/meandnotyou/rMXnY
我的phonegap应用程序有问题.我想在按下后退按钮时最小化应用程序(在后台发送应用程序以使其仍在运行).
这是我的代码.
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
}
Run Code Online (Sandbox Code Playgroud)
如果我使用navigator.app.exitApp();- 我的应用程序将终止,如果我使用navigator.app.backhistory()- 它将返回上一页.
我希望如果按下"返回"按钮,它会将我发送到主屏幕并将应用程序发送到后台,以便它仍在运行.谢谢.
我第一次尝试使用Cordova本机插件.我开始使用相机和文档中提供的示例代码.然而,这是失败的,并且navigator.camera未定义.
我已经包含了下面的代码.
<div data-role="page" id="CameraPage">
<script type="text/javascript" charset="utf-8">
var pictureSource; // picture source
var destinationType; // sets the format of returned value
// Wait for device API libraries to load
//
document.addEventListener("deviceready",onDeviceReady,false);
// device APIs are available
//
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
}
// Called when a photo is successfully retrieved
//
function onPhotoDataSuccess(imageData) {
alert("Photo Data Success");
// Uncomment to view the base64-encoded image data
// console.log(imageData);
// Get image handle
//
var smallImage = document.getElementById('smallImage'); …Run Code Online (Sandbox Code Playgroud) 我有一个JQM应用程序,其中有一个简单的搜索页面,将结果显示为列表视图.我已将listview包装在scrollview中.它工作得很好,但是大约一半的时间滚动你选择的任何列表项目.我想抑制这种行为.
我想看到的行为是,如果你滚动并抬起手指,那么就停止滚动.如果您不滚动并点击(单击),那么您正在选择.
<div id="vehicleScroller" data-scroll="y" style="height:444px">
<p>
<ul id="vehicleSearchResults" data-role="listview">
<li>
<a href="#PartyDetailsPage" data-id='${Number}'
onclick='return $.vehicle.PartyItemClick();'>
${Name}
</a>
</li>
[... more li's...]
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
我已经将一些诊断日志记录添加到jquery.mobile.scrollview并观察触发的事件.我希望我可以在滚动时停止点击,但_handleDragStop总是在PartyItemClick()之前触发.
我也玩过改变delayedClickEnabled的开关,但它似乎没有影响链接点击行为.
我准备为_handleDragStop事件添加一些额外的计时代码,我可以查看是否我刚刚滚动并想问几个问题:
1)在我添加这个hacky计时代码之前,是否有更好的方法来取消该链接点击?
2)如果我想将自己的事件处理程序代码添加到_handleDragStop,我该怎么做.我已经尝试了一些bind()调用,但我必须得到错误的事件名称.这就是我尝试过的:
$('#vehicleScroller').bind('_handleDragStop',function(){
console.log('_handleDragStop-vehicleScroller');
});
Run Code Online (Sandbox Code Playgroud)
更新:我最终使用以下代码将一些遥测嫁接到scollview _handleDragMove事件:
// adding some custom code to the scrollview to track the
$.mobile.scrollview.prototype._handleDragMove = (function() {
var origDragMove = $.mobile.scrollview.prototype._handleDragMove;
return function __handleDragMove() {
$.util.SetLastMoveTime(); // this is the only new line of code
origDragMove.apply(this, arguments);
};
}());
Run Code Online (Sandbox Code Playgroud)
然后,当我处理点击事件时,我检查是否已经过了足够的时间.
this.SearchResultItemClick = function(){
if($.util.WasScrolling()) {
event.stopPropagation();
return false; …Run Code Online (Sandbox Code Playgroud) 在今天早些时候(2012年7月13日)升级到jQuery Mobile 1.1.1之后,我注意到我的所有自定义选择菜单都不再在页面加载时显示占位符文本.我在1.1.1中需要做些什么来在自定义选择菜单中显示占位符文本吗?救命!?!?
这是我的代码示例:
<div data-role="fieldcontain" class="ui-hide-label no-field-separator">
<label for="ceiling" class="select" data-theme="a">Ceiling</label>
<select name="ceiling" id="ceiling" data-theme="a" data-native-menu="false" class="required">
<option data-placeholder="true">Ceiling (Yes/No)</option>
<option value="Yes">Ceiling: Yes</option>
<option value="No">Ceiling: No</option>
</select>
</div>
Run Code Online (Sandbox Code Playgroud)
示例图像(黑条是我的自定义选择菜单):

尝试使用cordova 2.0.0并使用此代码检查互联网连接
document.addEventListener("deviceready", onDeviceReady(), false);
function onDeviceReady() {
alert("ready");
db = window.openDatabase("loginintro", "1.0", "loginintro", 1000000);
db.transaction(populateDB, errorCB, successCB);
checkConnection();
}
function checkConnection()
{ alert("connection");
network = navigator.network.connection.type;
alert("fdfd");
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
alert('Connection type: ' + states[networkState]);
}
Run Code Online (Sandbox Code Playgroud)
但在这条线上得到错误
network = navigator.network.connection.type;
Run Code Online (Sandbox Code Playgroud)
和错误是:
04-09 15:20:23.989: E/Web Console(13329): Uncaught …Run Code Online (Sandbox Code Playgroud) 我1.9.1 min在PhoneGap上使用jQuery mobile .
我有一个列表,其中每个单击打开一个动作弹出窗口:
function showActions(index){
selectedIndex = index;
$("#actionPopup").popup("open", {positionTo: '#list li:nth-child('+ index +')'});
}
Run Code Online (Sandbox Code Playgroud)
<div data-role="popup" id="actionPopup" data-overlay-theme="a">
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
<ul data-role="listview">
<li data-role="divider">Actions</li>
<li data-icon="false" onclick="showDetails();">action1</li>
<li data-icon="false">action2</li>
<li data-icon="false">action3</li>
<li data-icon="false">action4</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
当我按下action1时,showDetails()会调用方法,但不会显示第二个弹出窗口.
function showDetails(){
console.log("showDetails");
$("#infoPopup").popup("open");
}
Run Code Online (Sandbox Code Playgroud)
<div data-role="popup" id="infoPopup">
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
<div id="infoContent">
<table>
<tr id="eventcode">
<td>test1:</td>
<td> </td>
</tr>
<tr id="eventtype">
<td>test2:</td>
<td> </td>
</tr>
</table>
</div> …Run Code Online (Sandbox Code Playgroud) 我需要实现一些在一个时间间隔内触发操作的功能,并将结果发送回javascript.
为简化起见,我将使用PhoneGap文档中的echo示例:
- (void)echo:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}
Run Code Online (Sandbox Code Playgroud)
我想让这个调用与echo一样回调,直到stop被调用.
我创建了一个每秒调用另一个函数的计时器,但我不知道如何保持回调的上下文以将结果发送到.
//Starts Timer
- (void)start:(CDVInvokedUrlCommand*)command
{
[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(action:)
userInfo:nil
repeats:YES];
}
//Called Action
-(void)action:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate runInBackground:^{
NSLog(@"TRIGGERED");
}];
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将其保持在回调的上下文中都会很棒.谢谢!
描述
我阅读了很多如何配置 Autofac.Extras.Quartz 以添加 Autofac 集成,但它根本不起作用,我为这些问题而苦苦挣扎:
我花了很多时间来弄清楚如何正确启动它(这看起来很简单但在我的情况下不可行),与我的案例关闭问题最相关的项目,人们遇到了同样的问题,但通过它并没有帮助. 任何帮助表示赞赏。
代码:
...
// Configure Autofac
var builder = new ContainerBuilder();
...
builder.RegisterModule<AutofacRepositoryModule>(); // registration of repositores
...
builder.RegisterModule(new QuartzAutofacFactoryModule());
builder.RegisterModule(new QuartzAutofacJobsModule(typeof(ConvertOrdersJob).Assembly));
builder.RegisterType<JobScheduler>().AsSelf();
var container = builder.Build();
ConfigureScheduler(container);
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
...
private static void ConfigureScheduler(IContainer container)
{
var scheduler = container.Resolve<JobScheduler>();
scheduler.Start();
}
Run Code Online (Sandbox Code Playgroud)
在 AutofacRepositoryModule 中注册存储库:
public class AutofacRepositoryModule : Module
{
protected override void Load(ContainerBuilder builder)
{
...
builder.RegisterType<DumpReportRepository>().As<IDumpReportRepository>();
...
} …Run Code Online (Sandbox Code Playgroud) Visual Studio不显示具有DesignInstance属性的设计时数据.我已经检查DesignInstance过/没有MVVM Light.我花了很多时间来解决这个问题(也检查了StackOverflow上的类似问题),但DesignInstance根本不起作用.
项目:
SearchIdView. SearchIdViewModel - 真实的视图模型.DesignSearchIdViewModel- 继承SearchIdViewModel并包含设计时数据(属性在构造函数中分配).环境:
SearchIdView.xaml
<Window x:Class="App1.View.SearchIdView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ignore="http://www.ignore.com"
xmlns:design="clr-namespace:App1.Design"
mc:Ignorable="d ignore"
DataContext="{Binding SearchId, Source={StaticResource Locator}}"
d:DataContext="{d:DesignInstance d:Type=design:DesignSearchIdViewModel,IsDesignTimeCreatable=True}"
>
<Grid>
<TextBlock Text="{Binding Test}" />
</Grid>
Run Code Online (Sandbox Code Playgroud)
SearchIdViewModel.cs
物业来自 SearchIdViewModel
public const string TestPropertyName = "Test";
private string _test;
public string Test
{
get
{
return _test;
}
set
{
Set(TestPropertyName, ref _test, value);
}
}
Run Code Online (Sandbox Code Playgroud)
你知道为什么DesignInstance在这种情况下不起作用吗? …
我正在构建我的第一个JQM网站,所以我想我错过了一些简单的小东西,这些东西给我带来了很多问题.
我已经设置了页面,页眉,内容和页脚以及菜单面板.然后我有一个带有以下内容的js文件:
$(document).on('pageinit', function (event) {
alert('this works every time you navigate to another page');
$("#menu-panel").panel("open");//this works the first time only
$("#new-lump-sum").popup("open");//this never works
});
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我为什么我每次导航到另一个页面时都会出现这种行为而不是面板和弹出窗口?
我也无法从浏览器控制台以编程方式打开它们(使用chrome)
这是我的HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cashflow - IFA Portal</title>
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="/Styles/jquery.mobile-1.3.1.min.css" rel="stylesheet" />
<link href="/Styles/System.css" rel="stylesheet" />
<script src="/Scripts/jquery-1.7.1.min.js"></script>
<script src="/Scripts/jquery.mobile-1.3.1.min.js"></script>
<script src="/Scripts/highcharts.js"></script>
<script src="/Scripts/System.js"></script>
</head>
<body class="computer android">
<div id="page-wrapper">
<div data-role="page" class="page ui-responsive-panel"><!-- Start Page -->
<div …Run Code Online (Sandbox Code Playgroud) 在我的网站中,我看到在浏览器的前进按钮选择期间调用了pageinit.它是否正确.这不会两次绑定已注册的事件.
First.html
<!DOCTYPE HTML>
<html>
<head>
<title>Test1</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script src="../scripts/common.js"></script>
</head>
<body>
<div data-role="page" id="first">
<h1 style="background: red">Swipe 1</h1>
<a href="second.html">Click</a>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Second.html
<!DOCTYPE html>
<html>
<head>
<title>Test2</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script src="../scripts/common.js"></script>
</head>
<body>
<div data-role="page" id="second">
<div data-role="header">
<h1>jQuery Mobile</h1>
</div>
<div data-role="content">
<a …Run Code Online (Sandbox Code Playgroud) 我正在使用Cordova 3.0.我能够创建一个骨架项目并运行它没有任何问题.现在我想添加设备插件.以下是我的步骤:
1.添加资产\ www\device.js
2.修改res\xml\config.xml并添加:
<feature name="Device">
<param name="android-package" value="org.apache.cordova.Device" />
</feature>
Run Code Online (Sandbox Code Playgroud)
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Run Code Online (Sandbox Code Playgroud)
添加了src\Device.java
在index.html中我添加了脚本src:
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="device.js"></script>
<script type="text/javascript" src="js/index.js"></script>
Run Code Online (Sandbox Code Playgroud)
在index.js中我添加了以下代码:
onDeviceReady: function() {
app.receivedEvent('deviceready');
console.log('device.model=>' + device.model);
},
Run Code Online (Sandbox Code Playgroud)
我在Android模拟器上构建并运行并获取错误:
10-03 12:22:49.998:E/Web控制台(637):未捕获的ReferenceError:在文件中未定义require:///android_asset/www/device.js:22
10-03 12:22:50.489:I/Web Console(637):device.model => undefined at file:///android_asset/www/js/index.js:40
关于什么我失踪的任何想法?我已按照phonegap网站上的说明 http://docs.phonegap.com/en/edge/cordova_device_device.md.html#Device
cordova ×6
c# ×2
cordova-3 ×2
popup ×2
.net ×1
asp.net ×1
highcharts ×1
listview ×1
mvvm ×1
mvvm-light ×1
panel ×1
placeholder ×1
quartz.net ×1
scrollview ×1
select-menu ×1
wpf ×1