在我buildType
看来这个:
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Run Code Online (Sandbox Code Playgroud)
我有一些问题:
我在使用Chrome 68.
每当我filter: invert(xxx);
进入时<body>
,任何定位fixed
都不会粘在屏幕上,它会滚动所有内容.
演示用 filter: invert(xxx);
body{
height: 8000px;
filter: invert(0.85);
}
div{
position: fixed;
top: 0;
left: 0;
height: 100px;
width: 100px;
border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)
<div></div>
Run Code Online (Sandbox Code Playgroud)
没有演示 filter: invert(xxx);
body{
height: 8000px;
}
div{
position: fixed;
top: 0;
left: 0;
height: 100px;
width: 100px;
border: 1px solid black;
}
Run Code Online (Sandbox Code Playgroud)
<div></div>
Run Code Online (Sandbox Code Playgroud)
编辑:适用于Chrome 67,但不适用于Chrome 68.
我目前正在开发的拖放系统存在一个问题。
我:hover
在div上有一种样式,用户可以在上面放置一些东西。当我只是将鼠标悬停在它上面时,它就起作用了,但是当我拖动一个元素时,它就没有作用。
有没有变通办法即使在拖动时也能显示该样式?
$(document).on('dragstart','#draggable',function(e){
e.originalEvent.dataTransfer.setData("data",$(this).attr('data-text'));
});
$(document).on('drop','#droppable',function(e){
console.log(e.originalEvent.dataTransfer.getData("data"));
});
$(document).on('dragover','#droppable',function(e){
e.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
div{
display: inline-block;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
font-family: Arial
}
#droppable{
border: 2px solid green;
}
#droppable:hover{
background-color: rgba(0,0,0,0.2);
}
#draggable{
border: 2px solid blue;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="droppable">Hover me !</div>
<div id="draggable" draggable="true" data-text="I exist too ! :(">Drag me !</div>
Run Code Online (Sandbox Code Playgroud)
这不会在"Try Flow"上编译:
/* @flow */
type A = { a: number, b: string};
type B = { a: string, b: string };
const x: A = { a:1, b:'2' };
const y: B = { ...x, a: x.a.toString() }
Run Code Online (Sandbox Code Playgroud)
错误是:
const y: B = { ...x, a: x.a.toString() }
^ Cannot assign object literal to `y` because number [1] is incompatible with string [2] in property `a`.
References:
3: type A = { a: number, b: string};
^ [1]
4: …
Run Code Online (Sandbox Code Playgroud) 我偶然发现了一个似乎是关于Chrome 65的错误iframes
.
我不能用一个片段来演示这个,所以我使用了这个JSFiddle.
问题是,如果iframe
是display: none;
,则.print()
上说,iframe
不会打印出任何东西.
它只发生在Chrome 65上,而不是Chrome 64上.
这是代码:
<iframe id="frame"></iframe>
<iframe id="frame2" class="hidden"></iframe>
<button class="db">Print without display: none;</button>
<button class="dn">Print with display: none;</button>
$('.db').on('click',function(){
$('#frame').contents().find('body').append('<p>Test without <code>display: none;</code>!</p>')
$('#frame')[0].contentWindow.print();
});
$('.dn').on('click',function(){
$('#frame2').contents().find('body').append('<p>Test with <code>display: none;</code>!</p>')
$('#frame2')[0].contentWindow.print();
});
.hidden{
display: none;
}
Run Code Online (Sandbox Code Playgroud)
PS:不要尝试将其编辑为片段,iframe在其中不起作用.
我已将我的Play Framework版本从2.4.1更新到2.5.6,但现在我遇到了Web套接字管理问题.
我有一个Controller类,其中方法liveUpdate()
返回一个WebSocket<String>
实例.
在这种方法我用WebSocket.whenReady()
用Out<String>
在HashMap<Out<String>, String>
哪里,关键是在客户端输出流和值是String
包含,因为当我需要发送广播消息我迭代的语言信息HashMap
.
现在所有这些都在2.5.6中删除或弃用!
在网上搜索我发现新的实现基于Akka Streams使用Flow
该类,但我不知道如何调整我的代码.
WebSocket.whenReady()
被替换为 WebSocket.Text.accept()
Out<?>
通过与阿卡流替换Flow
类这是我的代码:
Alarms.java
public class Alarms extends Controller {
@Inject
private ActiveAlarms activeAlarms;
[...]
public WebSocket liveUpdate() {
return WebSocket.whenReady((in, out) -> {
in.onMessage(language ->{
activeAlarms.register(out, language);
});
in.onClose(() -> activeAlarms.unregister(out));
});
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
ActiveAlarms.java
public class ActiveAlarms{
private HashMap<Out<String>, String> …
Run Code Online (Sandbox Code Playgroud) 我需要通过PHP脚本中的"得分"值对这类信息进行排序,我该怎么办?:
Array
(
[0] => stdClass Object
(
[name] => Morts par Déshydratation
[score] => 4
[id] => dwater
)
[1] => stdClass Object
(
[name] => Réparations de chantiers
[score] => 87
[id] => brep
)
[2] => stdClass Object
(
[name] => Campeur téméraire
[score] => 77
[id] => camp
)
[3] => stdClass Object
(
[name] => Décoration
[score] => 112
[id] => deco
)
)
Run Code Online (Sandbox Code Playgroud)
PS:这已经是PHP值,我已经使用过json_decode.*
我一直在努力解决这个简单的脚本,并且在 StackOverflow 中找不到相关问题。这是我的问题。
我有两个盒子。<div class="notselected">
如果通过单击事件变为,则框将以蓝色突出显示<div class="selected">
。
如果没有选择任何框,则父框应以红色突出显示,如下所示:
这是一个片段:
$(document).ready(function(){
var parent = $(this).find(".parent");
if(parent) {
var selected = parent.find("div.selected");
if(selected) {
selected.css({"color": "blue", "border": "2px solid blue"});
}
else {
parent.css({"color": "red", "border": "2px solid red"});
}
}
});
Run Code Online (Sandbox Code Playgroud)
.ancestors *:not(script) {
display: block;
border: 2px solid lightgrey;
color: lightgrey;
padding: 5px;
margin: 15px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body class="ancestors">
<div class="parent"> Parent Box
<div class="notselected"> Box A </div>
<div class="notselected"> Box B </div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
请让我知道我缺少什么。谢谢你的帮助!
我目前正在尝试用Stylish创建一个黑暗的SO主题.在我必须自定义代码段之前,一切都很顺利.我似乎无法将选择颜色更改为除预定义之外的任何颜色:
.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{
background:#d7d4f0;
}
Run Code Online (Sandbox Code Playgroud)
我尝试添加这个,但没有任何改变:
.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{
background: blue !important;
}
Run Code Online (Sandbox Code Playgroud)
反正有没有改变这里的选择背景?
这是主题中的完整CSS,如果它有帮助:
body, #questions div, .qa-block, #content {
background:#282828 !important;
}
#footer.categories {
background:#181818 !important;
}
.post-text {
background:#D5D5D5 !important;
color:#000000;
}
h1, h2, h3, h4 .page-description td, p, .owner-revision span, .revision span, div.container, #mdhelp pre, .badgecount, .comments, .user-panel-content td, .user-panel-content th, .content-page, .viewcount, .welovestackoverflow, .vote-count-post, .summarycount, #sidebar.module p .vote-count-post, .answer-votes, div.comment-body, h1 a, h4, span.reputation-score, div.module.question-stats p, span.page-numbers, #newsletter-ad, .item-summary, div.new-about-content-page.about-content-page div h2.about-title, .module.newuser, .page-description td, .bulletin-title, .status.answered span, …
Run Code Online (Sandbox Code Playgroud) 我以为我对 async await 有很好的理解,直到我尝试了这个:
const promise1 = new Promise((resolve, reject) => {
setTimeout(() => resolve('what'), 10000);
});
const promise2 = new Promise((resolve, reject) => {
setTimeout(() => resolve('?'), 15000);
});
async function asyncTest() {
console.time();
const p1 = await promise1;
if (p1 === 'what') {
var p2 = await promise2;
}
console.log(p1, p2);
console.timeEnd();
}
asyncTest()
Run Code Online (Sandbox Code Playgroud)
15000 毫秒后,asyncTest
正在记录p1
& p2
。如果取而代之的是promise1
和promise2
转换为返回这些承诺的函数,则执行时间为 25000 毫秒。我不知道是怎么回事。有人能解释一下吗?
css ×5
javascript ×4
akka ×1
akka-stream ×1
android ×1
async-await ×1
asynchronous ×1
css-filters ×1
css-position ×1
draggable ×1
flowtype ×1
hover ×1
html ×1
iframe ×1
java ×1
jquery ×1
json ×1
php ×1
proguard ×1
selection ×1
sorting ×1
typescript ×1
websocket ×1