禁用单击分钟单元格 [英] Disabling click on minute cell
问题描述
我有html表和一个文本框和一个button.make单元格选择通过拖动单元格。单击按钮我得到文本框的值,并放入单元格的span标签。我不得不点击分钟小区0,15,30,45。在小提琴中你看到当我点击分钟单元格然后它使css变为绿色并且css长度增加(那些在警告中chking)。
i have html table and one textbox and one button.make cell selection by dragging on cell .on click of button i am getting value of textbox and put into span tag of cell. i have to disble click on minute cell 0,15,30,45. In fiddle u see when i click on minute cell then it makes css green and css length is incremented (those chking in alert).
推荐答案
<这是你想要的吗?
- 编辑 -
现在,您只能以直线方式(向上或向下)突出显示。
可能有更优雅的方式来做所有这些,但我认为这将按你的要求运作
Now you can only highlight in a straight way (up or down). Probably there is a more elegant way to do all of this but i think this will works as you want
DEMO: < a href =http://jsfiddle.net/vrW2n/9/ =nofollow> http://jsfiddle.net/vrW2n/9/
// Add this variable
var lastRow = 0;
在 mousedown()
:
// This line gets the index of the first clicked row.
lastRow = $(this).closest("tr")[0].rowIndex;
active = true;
$(".csstdhighlight").removeClass("csstdhighlight"); // clear previous selection
//This is the big trick
$(".temp_selected").removeClass("temp_selected");
...
并且在 mousemove()
:
...
/* Begin my edit
Compares the actual 'mousemove' row index
with the last and next row index
*/
var thisRow = $(this).closest("tr")[0].rowIndex;
if( lastRow == thisRow || lastRow == thisRow - 1 || lastRow == thisRow + 1 ){
lastRow = $(this).closest("tr")[0].rowIndex;
}else
return;
// End my edit
...
这篇关于禁用单击分钟单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!