我想更改所有标题,通常这很容易(它可能仍然是).通过我,颜色将仅取决于数据属性的属性,所以我必须首先过滤它.这工作但现在只有我不能在标题上设置CSS.我收到这个错误
script.js:175Uncaught SyntaxError:意外的字符串
上:
$("h1").css("border-bottom":"2px solid rgb(255, 0, 0)");
Run Code Online (Sandbox Code Playgroud)
我想我必须将$(this)与"h1"结合起来,但我不知道如何.
function setSectionColors() {
// set headlines correct color
var blockIncrement = 1/rows;
for(var i = 0; i < rows; i++) {
var min = i*blockIncrement;
var max = (i+1)*blockIncrement;
// sloppy fix
if(min > 0) {
min += 0.00000001;
}
$(".headline").filter(function() {
return ((parseFloat($(this).attr("data-rating")) >= min) && (parseFloat($(this).attr("data-rating")) <= max));
}).each(function() {
// getRowColor here instand of red
console.log($(this));
$("h1").css("border-bottom":"2px solid rgb(255, 0, 0)");
});
}
}
Run Code Online (Sandbox Code Playgroud)
这是console.log($(this))的输出之一;
<div class="headline" …Run Code Online (Sandbox Code Playgroud) 我有一个像这样的javascript类(我知道它在技术上不是一个类).
function StackMedia (container) {
this.container = container;
this.items = container.find('.stackItem');
console.log("this.items.length: "+this.items.length);
}
Run Code Online (Sandbox Code Playgroud)
我传递一个容器(div),其中包含css类stackItem的其他div,它们存储在项目中.
在这里,我想重用它:
StackMedia.prototype.updatePositions = function() {
for (var i = 0; i < this.items.length; i++) {
this.items[i].css('left', 50);
}
}
Run Code Online (Sandbox Code Playgroud)
问题是它不再是一个jquery对象,所以我得到这个错误:
TypeError:'undefined'不是函数(评估'this.items [i] .css('left',50)')
我如何将它们存储为jquery对象?
更新
这是我创建类的地方(工作正常):
// create a stack by passing a container
$('.stackContainer').each(function(containerIndex) {
$(this).css('z-index', containerIndex);
stacks.push(new StackMedia($(this)));
});
Run Code Online (Sandbox Code Playgroud)
除最后一行外,这几乎没问题
StackMedia.prototype.updatePositions = function() {
var sm = this; // StackMedia
// set the css properties of the items
this.items.each(function(i){
$(this).css('left', sm.x + i …Run Code Online (Sandbox Code Playgroud) 在文档中,他们一直在谈论merges文件夹.
像merges/android一样,这是平台文件夹吗?
因为我有平台/ android和平台是唯一的文件夹与android文件夹.
如果平台是merges文件夹,那么为什么他们不谈论平台文件夹呢?
(可能很明显,但我只是想确定)
在上面的链接中搜索"使用合并自定义每个平台",查看我的意思.
这是我目前的结构:

我有一个图标题,我想要其中的文字。这就是 chrome 元素检查器中的样子。由于某种原因,“innerHTML”以回车符开头,然后是很多空格。然而“innerText”看起来不错,所以我对此很感兴趣。

在网上我看到我必须使用该text()方法来获取innerText,但它似乎给出了innerHTML:
console.log("-"+$(this).find("figcaption").text()+"-");
Run Code Online (Sandbox Code Playgroud)

那么我怎样才能到达innerText呢?
我尝试查看某些文件以进行更改.但WatchKey我得到watch_object.watch_service.poll(16, TimeUnit.MILLISECONDS);的总是null.没有一个错误打印到控制台,所以我有点迷路.
public class FileWatcher implements Runnable {
public FileWatcher() {
}
static public class Watch_Object {
public File file;
public WatchService watch_service;
}
static public HashMap<Object, Watch_Object> watched_files = new HashMap<>();
static public boolean is_running = false;
static public synchronized void watch(Object obj, String filename) {
File file = new File(filename);
if (file.exists()) {
try {
WatchService watcher = null;
watcher = FileSystems.getDefault().newWatchService();
Watch_Object watch_object = new Watch_Object();
watch_object.file = file;
watch_object.watch_service = …Run Code Online (Sandbox Code Playgroud) 在过去的5年里,我收到了一份包含我所有电子邮件活动的大文件.我想把所有带有问号的句子都拿回来.我对正则表达式不太满意,我只知道可以做些什么.
有人能给我一个有效的正则表达式吗?(Java)的
如果有可能,那么我想在下一个例子中返回粗体:
Lorem ipsum dolor坐下来,精致的adipistur elit.Sed amet elementum.Integer nec diam erat,eu consectetur nibh?Cum sociis natoque penatibus et magnis dis parturient montes.
我想在最后一个标签(或逗号)之前删除所有内容.
例如,在这句话中:
Hoe treedt een gevestigd instsut als het Nederlands Openluchtmuseum,alom geassocieerd遇到了ambacht en traditie,buiten zijn grenzen op zoek naar vernieuwing?
应该
naar vernieuwing?
Ik heb ruim 6 weken geleden een boek besteld en ik wacht nog steeds,enig idee hoe lang dit wachten nog gaat duren?
应该
enig idee hoe lang dit wachten nog gaat duren?
我试过这个,
"^(.*\t +)+"但这不起作用.
我真的想得到一个页面的滚动条因为atm东西离开窗口好像溢出:隐藏设置但我没有使用它.
我可以在这里删除所有代码,但我认为jsfiddle将更好地服务:
我试过了
body {
border: 0;
padding: 0;
margin: 0;
font-family: "Helvetica";
font-size: 20px;
overflow: visible;
}
Run Code Online (Sandbox Code Playgroud)
还有滚动,自动,继承,这一切都没有帮助.
我遇到了以下错误的问题:
令牌";"上的语法错误,{在此令牌
语法错误后插入,插入"}"以完成EnumBody
public enum ImpNoise {
INSTANCE;
private int p[] = new int[512];
for(int i = 0; i < 256; i++) {
}
}
Run Code Online (Sandbox Code Playgroud)
正如你在上面所看到的那样,我将整个班级剥离到最低限度.我发现for循环导致了问题.但我真的不明白,看起来还不错吧?
假设我有以下输入字符串:
range (bar | thumb_1 | thumb_2 | fill)
range(bar|thumb_1|thumb_2|fill)
.root.range.bar
Run Code Online (Sandbox Code Playgroud)
然后我想要以下输出:
.range (.bar | .thumb_1 | .thumb_2 | .fill)
.range(.bar|.thumb_1|.thumb_2|.fill)
.root.range.bar
Run Code Online (Sandbox Code Playgroud)
到目前为止我有这个:
void setup() {
test("range (bar | thumb_1 | thumb_2 | fill)");
test("range(bar|thumb_1|thumb_2|fill)");
test(".root.range.bar");
}
void test(String in) {
String r = in.replaceAll("(\\w+)", "\\.$1"); // add . prefix to every word
println(r);
}
Run Code Online (Sandbox Code Playgroud)
问题是,如果单词已经有一个点前缀,它将添加另一个.我一直在尝试各种各样的事情[^\\.].但要么它不在最后一个输入字符串上工作,要么它开始在第一个和第二个输入字符串上吃错字符.
如何正确忽略前面已有点的情况?