目前,此代码在完成后将 CSS 样式应用于单词。我需要将样式应用于单个字母以确定它们是否正确放置。
$(".drop").droppable({
drop: function(event, ui) {
word = $(this).data('word');
guesses[word].push($(ui.draggable).attr('data-letter'));
console.log(guesses);
if (guesses[word].length == 3) {
if (guesses[word].join('') == word) {
$('td[data-word=' + word + ']').addClass("wordglow2").fadeOut(1300);
} else {
$('td[data-word=' + word + ']').addClass("wordglow");
}
}
}
});
CSS是...
.wordglow {
-webkit-box-shadow: inset 2px 2px 20px 7px #ff0000;
box-shadow: inset 2px 2px 20px 7px #ff0000;
}
.wordglow2 {
-webkit-box-shadow: inset 2px 2px 20px 7px #22ff22;
box-shadow: inset 2px 2px 20px 7px #22ff22;
}
我试过这个,但没有快乐......
$(".drop").droppable({
drop: function(event, ui) {
word = $(this).data('word');
guesses[word].push($(ui.draggable).attr('data-letter'));
console.log(guesses);
if (guesses[word].length == 3) {
if (guesses[word].join('') == word) {
$('td[data-letter=' + word + ']').addClass("wordglow2").fadeOut(1300);
} else {
$('td[data-letter=' + word + ']').addClass("wordglow");
}
}
}
});