我想做以下,
应在悬停时选择日期。
如果在日历中选择了任何日期,则在悬停时我需要在病房中应用该元素的类(“选定”)。
我使用以下脚本完成了此功能。
$("#WBECalBodyNav a").hover(function (e) {
if ($("#WBECalBodyNav a.WBECheckIn").length != 0) {
//Step 1: Check for the current element Parent.
if ($(this).parent().attr("id") == "WBECalRightPane") {
//Step 2: Remove all selected classes before Checkin Class
$("#WBECalBodyNav").children().eq(1).find("a.WBESelected.WBECheckIn").prevAll().removeClass("WBESelected");
//Step 3: Find Checkin Class and remove Chekout class until current element.
$("#WBECalBodyNav").children().eq(1).find("a.WBESelected.WBECheckIn").nextUntil($(this)).removeClass("WBECheckOut");
//Step 4: Find Checkin Class and add Selected class until current element.
$("#WBECalBodyNav").children().eq(1).find("a.WBESelected.WBECheckIn").nextUntil($(this)).addClass("WBESelected");
//Step 5:Add Checkout Class for Current element
$(this).addClass("WBESelected WBECheckOut");
//Step 6: Remove Selected,Checkout Class for current element next all elements
$("#WBECalBodyNav").children().eq(1).find($(this)).nextAll().removeClass("WBESelected WBECheckOut");
////Step 7: Remove Checkout Class for current element next all elements
//$("#WBECalBodyNav").children().eq(0).find($(this)).nextAll().removeClass("WBECheckOut");
}
else {
//Step 2: Remove all selected classes before Checkin Class
$("#WBECalBodyNav").children().eq(0).find("a.WBESelected.WBECheckIn").prevAll().removeClass("WBESelected Chekout");
//Step 3: Find Checkin Class and remove Chekout class until current element.
$("#WBECalBodyNav").children().eq(0).find("a.WBESelected.WBECheckIn").nextUntil($(this)).removeClass("WBECheckOut");
//Step 4: Find Checkin Class and add Selected class until current element.
$("#WBECalBodyNav").children().eq(0).find("a.WBESelected.WBECheckIn").nextUntil($(this)).addClass("WBESelected");
//Step 5:Add Checkout Class for Current element
$(this).addClass("WBESelected WBECheckOut");
//Step 6: Remove Selected,Checkout Class for current element next all elements
$("#WBECalBodyNav").children().eq(0).find($(this)).nextAll().removeClass("WBESelected WBECheckOut");
//Step 7: Remove Checkout Class for current element next all elements
//$("#WBECalBodyNav").children().eq(0).find($(this)).nextAll().removeClass("WBECheckOut");
}
//Step 8: Return False
e.preventDefault();
}
});
它适用于各个div元素,但我想要总共2个div元素。
即,如果我在第一个div中选择任何日期,我应该能够在第二个div上继续我的选择。
但是,此当前脚本无法执行此功能。
请提供您的建议。