我希望得到一个元素在被拖动时的位置.
我的代码到目前为止:
$(document).ready(function(){
$("p").text($("div").position().left);
$("p").text($("div").position().top);
$("div").draggable();
})
Run Code Online (Sandbox Code Playgroud)
这只会在页面加载时获取位置.我想检测div何时被拖动,所以我可以在p标签中写出它的位置.
每当用户调整可调整大小的文本区域时,我都会尝试检测..
我正在尝试使用此代码,但它不起作用:
$('textarea.note').bind("resize", function(){
alert("resize!!!!!");
})
Run Code Online (Sandbox Code Playgroud)
我不想真的使用任何类型的计时器和循环..帮助!?
编辑: 我实际上使用PHP来检测和创建一个带有php标签的局部变量.
if ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit')) {
$is_webkit = "true";
}
Run Code Online (Sandbox Code Playgroud)
如何检测浏览器是否基于webkit?(谷歌Chrome,更新的Opera,safari);
我试过这个:
var isWebkit = (window.webkitURL != null);
if(isWebkit){
alert("i am a webkit based browser!");
}
Run Code Online (Sandbox Code Playgroud)
不适用于野生动物园
我是JAVA的新手,我写了这段代码:
Map<String,Integer> map = new HashMap<String,Integer>();
map.add("Key",13);
Run Code Online (Sandbox Code Playgroud)
为什么它会在eclipse上给出错误:
The method add(String, int) is undefined for the type Map<String,Integer>
Run Code Online (Sandbox Code Playgroud)