如何在ASP.NET中处理鼠标滚轮按钮事件?

问题描述 投票:0回答:1

我有一个项目,它使用EXT.NET框架进行控制。我目前正在研究关闭面板标签的行为,例如Google Chrome和所有现代浏览器。

我找不到答案。鼠标滚轮按钮的ASCII值是多少?如何在C#ASP.NET中处理此事件?

c# asp.net mousewheel
1个回答
0
投票

在Firefox,资源管理器和Chrome上工作:

    $(document).ready(function() {
        $(document).mousedown(function(e) {
            closeTab(e);
        });
    });


    function closeTab(e) {
        if (!e) {
            e = window.event;
            e.which = e.keyCode;
        }

        if(e.which == 2){
            var tbpPrincipal = <%= tbpPrincipal.ClientID %>;
            var activeTab = null;
            for (var i = 0; i < tbpPrincipal.items.length; i++) {
                var currentTab = tbpPrincipal.items.items[i];
                if (e.target.innerText == currentTab.title || e.target.textContent == currentTab.title) {
                    activeTab = currentTab;
                    break;
                }
            }

            if (activeTab) {
                var activeTabIndex = tbpPrincipal.items.findIndex('id', activeTab.id);
                tbpPrincipal.remove(activeTabIndex);
            }

        }
        return true;// to allow the browser to know that we handled it.
    }
© www.soinside.com 2019 - 2024. All rights reserved.