禁用单击分钟单元格 [英] Disabling click on minute cell

查看:65
本文介绍了禁用单击分钟单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看小提琴

我有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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆