|
|
@@ -256,23 +256,29 @@ function bindEventYS() {
|
|
|
|
|
|
//显示/隐藏习题答案
|
|
|
$(".yaoshi").on("click", function () {
|
|
|
- // 隐藏答案
|
|
|
- var NClsName = $(this).parent().attr("class") + " correntQue";
|
|
|
- var PClsName = $(this).parent().attr("class"); // 对错题有内容填写必然有correntQue,否则判断条件不成立
|
|
|
- if (PClsName.indexOf(" correntQue") > -1) {
|
|
|
- PClsName = PClsName.replace(" correntQue", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- PClsName = "";
|
|
|
- }
|
|
|
- var NextClsName = $(this).parent().next().attr("class");
|
|
|
- var PreClsName = $(this).parent().prev().attr("class");
|
|
|
+ var ParentAnid = $(this).attr("parent-anid");
|
|
|
if ($(this).attr("data-status") == "0") {
|
|
|
- if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().next().find(".yaoshi").attr("data-status", "1");
|
|
|
- $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
+ if (ParentAnid != undefined) {
|
|
|
+ $.each($(this).parents().find(".yaoshi[parent-anid='" + ParentAnid + "']"), function (index, FItem) {
|
|
|
+ $(FItem).attr("data-status", "1");
|
|
|
+ $(FItem).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ $.each($(FItem).next().find(".underlineContent"), function (index, item) {
|
|
|
+ if (!$(item).hasClass("no-answer")) {
|
|
|
+ $(item).css("color", "#92D050");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(item).css("color", "#989898");
|
|
|
+ }
|
|
|
+ $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $(this).attr("data-status", "1");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
if (!$(item).hasClass("no-answer")) {
|
|
|
$(item).css("color", "#92D050");
|
|
|
}
|
|
|
@@ -283,26 +289,6 @@ function bindEventYS() {
|
|
|
$(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
});
|
|
|
}
|
|
|
- if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("data-status", "1");
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- $(this).parent().prev().find(".underlineContent").css("color", "#989898");
|
|
|
- }
|
|
|
- $(this).attr("data-status", "1");
|
|
|
- $(this).attr("src", PicInfo.yaoshiShowImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#92D050");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- if (!$(item).hasClass("no-answer")) {
|
|
|
- $(item).css("color", "#92D050");
|
|
|
- }
|
|
|
- else {
|
|
|
- $(item).css("color", "#989898");
|
|
|
- }
|
|
|
-
|
|
|
- $(item).find(".wordStyle").css("color", "#db5d00");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#f2db8b");
|
|
|
- });
|
|
|
//不再存在已隐藏的钥匙,移动端回调
|
|
|
if ($(".yaoshi[data-status='0']").length == 0) {
|
|
|
//添加回调
|
|
|
@@ -310,30 +296,27 @@ function bindEventYS() {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- if (NClsName == NextClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().next().find(".yaoshi").attr("data-status", "0");
|
|
|
- $(this).parent().next().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- $.each($(this).parent().next().find(".underlineContent"), function (index, item) {
|
|
|
+ if (ParentAnid != undefined) {
|
|
|
+ $.each($(this).parents().find(".yaoshi[parent-anid='" + ParentAnid + "']"), function (index, FItem) {
|
|
|
+ $(FItem).attr("data-status", "0");
|
|
|
+ $(FItem).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ $.each($(FItem).next().find(".underlineContent"), function (index, item) {
|
|
|
+ $(item).css("color", "#ffffff");
|
|
|
+ $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
+ $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $(this).attr("data-status", "0");
|
|
|
+ $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
+ //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
+ $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
$(item).css("color", "#ffffff");
|
|
|
$(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
$(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
});
|
|
|
}
|
|
|
- if (PClsName == PreClsName && NClsName.indexOf(" group") > -1) {
|
|
|
- // 相同前缀且有分组才渲染
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("data-status", "0");
|
|
|
- $(this).parent().prev().find(".yaoshi").attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- $(this).parent().prev().find(".underlineContent").css("color", "#ffffff").css("background-color", "#ffffff");
|
|
|
- }
|
|
|
- $(this).attr("data-status", "0");
|
|
|
- $(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
- //$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
- $.each($(this).nextUntil(".yaoshi").filter(".underlineContent"), function (index, item) {
|
|
|
- $(item).css("color", "#ffffff");
|
|
|
- $(item).find(".wordStyle").css("color", "#ffffff");
|
|
|
- $(item).find(".phraseStyle").css("background-color", "#ffffff");
|
|
|
- });
|
|
|
//添加回调
|
|
|
onClickKeyHide();
|
|
|
}
|