我有一个p
带有一些文字的标签,而我正试图制作它,contenteditable
但只是双击.当我点击它时,如何防止浏览器将光标放在p上,只有在我双击时才这样做?JQuery的:
p.dblclick(function(e){
p.css("cursor", "text");
})
.focusout(function(){
p.css("cursor", "default");
})
.click(function(e){
console.log('focus p');
e.stopPropagation();
$("body").focus(); // not stopping Chrome from placing cursor
});
Run Code Online (Sandbox Code Playgroud)
我可以在contenteditable
默认情况下使其成为假,然后将其设为true dbleclick
然后执行,p.focus()
但这意味着我无法将光标放在我单击的位置.另一方面,我可以在第一次点击后让它满足,然后等待1.5s for dobuleclick,如果没有发生取消它,但如果它发生了,那么内容将是可编辑的,第二次点击将触发将光标放在正确的位置.然而,它不是那么平滑,并且使这些内容可以在这些1秒半内编辑.
回答:如果有人感兴趣,我继续实施计时器方法,因为我认为没有其他办法...这里是代码
var DELAY = 700, clicks = 0, timer = null;
p.focusout(function(){
p.css("cursor", "default");
p.prop("contenteditable", false);
})
.click(function(e){
clicks++;
p.prop("contenteditable", true);
if(clicks == 1){
timer = setTimeout(function() {
p.prop("contenteditable", false);
//alert("Single Click"); //perform single-click action
clicks = 0; //after action performed, reset counter
}, …
Run Code Online (Sandbox Code Playgroud) 有没有办法使用S3 配置单个CloudFront 发行版,以便
hello.world.com
提供来自 的文件my-bucket.s3.amazonaws.com/hello
,以及foo.world.com
来自 的文件my-bucket.s3.amazonaws.com/foo
?
我添加了一个带有 *.world.com 通配符 CNAME 的新发行版,并且可以按照描述添加源(通过指定根文件夹),但我不知道如何根据子域路由请求。在行为设置中,有path pattern
但我认为它不适用于域,而不是文件的路径。
基本上我想进行路径重写,以使用单个 s3 存储桶的单个 cloudfront 发行版上的子域替换第一个目录。
cname wildcard amazon-s3 amazon-web-services amazon-cloudfront
当我在写 Markdown 时,VSCode 经常将空格更改为其他内容,例如# Example
-> # Example
。它看起来一样,但它不是空格(eslint 说no-irregular-whitespace这是我能够发现它的方式,但在 MD 中没有显示)。
> `# Hello`.charCodeAt(0)
35
> `# Hello`.charCodeAt(1)
160
> `# Hello`.charCodeAt(2)
32
> `# Hello`.charCodeAt(3)
72
Run Code Online (Sandbox Code Playgroud)
它偶尔会引起很多麻烦。为什么这样做?
对于Flex 4.6按钮,可以定义标签和图标:
<s:Button icon="{@Embed('assets/icon.png'}" label="Do the dance" />
Run Code Online (Sandbox Code Playgroud)
corrsesponding皮肤部分是:iconDisplay:BitmapImage
并且labelDisplay:IDisplayText
由组件(adobe ref)设置.它们在ButtonBase.as中定义
spark.components.supportClasses.ButtonBase
//--------------------------------------------------------------------------
//
// Skin parts
//
//--------------------------------------------------------------------------
[SkinPart(required="false")]
/**
* A skin part that defines an optional icon for the button.
*
* @langversion 3.0
* @playerversion Flash 10.1
* @playerversion AIR 2.0
* @productversion Flex 4.5
*/
public var iconDisplay:BitmapImage;
[SkinPart(required="false")]
/**
* A skin part that defines the label of the button.
*
* @langversion 3.0
* @playerversion Flash 10
* …
Run Code Online (Sandbox Code Playgroud) javascript ×2
amazon-s3 ×1
apache-flex ×1
cname ×1
debugging ×1
flex-spark ×1
jquery ×1
jsdoc ×1
skins ×1
wildcard ×1