当我点击列表项目,转到另一个页面时,当前页面会跳转到屏幕顶部,然后转换到下一页面.
这个问题出现在jQM 1.2中,并且在新发布的1.3版本中仍然没有修复.
有人知道如何防止滚动到顶部,并在使用后退按钮时记住滚动位置吗?
这种恼人的行为是不可接受的,并打破了整个应用体验.
我在iPhone 4S上使用它作为webapp,使用iOS 6.1.2.
我在后台播放这个音频标签,我可以在几秒钟内将进度存储到cookie中.但是,我无法从该cookie启动音频.(继续在其他页面上)
$("p#sound audio").currentTime = $.cookie("audioTime");
<audio autoplay="autoplay" loop="loop" ontimeupdate="document.getElementById('tracktime').innerHTML = Math.floor(this.currentTime); $.cookie('audioTime', Math.floor(this.currentTime));">
<source src="audio/song.ogg" type="audio/ogg" />
<source src="audio/song.mp3" type="audio/mp3" />
Your browser does not support the audio tag.
</audio>
<span id="tracktime">0</span>
Run Code Online (Sandbox Code Playgroud)
这是否与从头开始重新加载的歌曲有关?
谢谢!
编辑:
$("p#sound audio").get[0].currentTime
Run Code Online (Sandbox Code Playgroud)
使用.get [0],它也不起作用.
有人可以帮我清理一下吗?非常感激!
我有这个iOS网络应用程序,需要通过Ajax提交表单,这在很大程度上是有效的.唯一不起作用的是键盘上的GO按钮没有响应.
在桌面浏览器上,一切都适用于提交(提交按钮或输入密钥)
在Safari iOS上,一切正常(提交按钮,GO键盘按钮)
但是当在iOS上将其用作Web应用程序时,GO按钮不起作用!
什么可能导致这种行为?据我所知,iOS网络应用仍然使用Safari ... :)
<form id="myForm" name="form" action="link-to-script.php" method="post">
<table>
<tr>
<td><input id="name" name="name" type="text" size="20" maxlength="25" /></td>
</tr>
<tr>
<td><input id="email" name="email" type="text" size="20" maxlength="50" /></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Send" /></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
$('#myForm').submit(function(e) {
e.preventDefault(); // Doesn't matter
var dataString = $(this).serialize();
$.ajax({
type: "POST",
url: "http://link-to-script.php?", // Valid link for the use of this form
cache: false,
data: dataString,
success: function() {
}
});
});
Run Code Online (Sandbox Code Playgroud)
更新(已解决):我已经删除了preventDefault().这不是瓶颈,但我不喜欢不必要的代码.:)
当我添加return false; …
这就是我到目前为止所做的,但无论我尝试什么,我album-content都不会被截断substr().
$gallery = preg_replace('/(<div class="album-content">)(.*?)(<\/div>)/e', "'$1' . substr(\"$2\", 0, 50) . '$3'", $gallery);
Run Code Online (Sandbox Code Playgroud)
更新:
原来我的班级名称不正确,我的正则表达式似乎确实有效.我只需要执行另一个str_replace()来取消输出.
$gallery = preg_replace('/(<div class="album-desc">)(.*?)(<\/div>)/e', "'$1' . substr(\"$2\", 0, 50) . '$3'", $gallery);
$gallery = str_replace('\"album-desc\"', '"album-desc"', $gallery);
Run Code Online (Sandbox Code Playgroud)
修改前的输出:
<a href="..." class="album">
<div class="album-content"><p class="album-title">Album 1</p>
<div class="album-desc"><p>This will be truncated by substr().</p></div>
</div>
<img src="..." />
</a>
Run Code Online (Sandbox Code Playgroud)
谢谢大家,反正!
我刚刚开始尝试使用OO PHP,但有一个基本原则我并没有真正理解它,并且没有找到太多的信息.
在创建__construct()方法时,为什么你想要它public,当它特别是该类的构造函数时?你什么时候想在课外调用构造函数?
对我来说,似乎使用受保护的构造函数是一种很好的做法,对吧?
我知道这是基本的OO东西,但我没有直接找到任何信息,特别是对于构造函数.
javascript ×2
jquery ×2
php ×2
ajax ×1
constructor ×1
css3 ×1
html-parsing ×1
html5 ×1
html5-audio ×1
ios ×1
ios5 ×1
jquery-ui ×1
regex ×1
visibility ×1