我正在尝试使Date Range Pickerthis类似。

我已经尝试使用类似的东西

     $('#calendar-dates').on('mouseover', 'td', function() {
         if($(this).html() > window.start){
          $(this).addClass("added");
        }
     });

      $('#calendar-dates').on('click', 'td', function() {
        window.start = $(this).html(); // get the number of the day

        $(this).addClass("start"); // to mark it the date-selection start

      });


我想要的是,如果我使用鼠标按钮将horizontally放在td之后的this day元素上,以使用background-color突出显示它们

要么

如果我去vertically更改上一行的background-color

我已经阅读过有关slice的信息,但我想不起来如何正确地利用它。

同样使用mouseover,在一点之后它将停止突出显示元素。

请帮忙。

最佳答案

你可以试试看



$( "#calendar-dates" ).mouseover(function() {
       // do something
}).click(function() {
      // do something
});

10-05 21:01
查看更多