在Firefox的奇怪的蓝色边界 [英] Strange blue border on Firefox

查看:132
本文介绍了在Firefox的奇怪的蓝色边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请查看此代码




Please, take a look at this code

http://www.jsfiddle.net/tt13/5CxPr/21

On firefox it shows strange blue border when you select multiple row by pressing ctrl button but on chrome it doesn't.

Using latest Firefox 10.0.2.

Is that browser related bug?

解决方案

This is due to text being selected - native browser behavior.

You can observe the same issue in Chrome as well by using the SHIFT key instead of CTRL.

To overcome this, you can simply clear the selection right after user click the cell to select:

$(".subject").live('click',function(event) {
    if(event.ctrlKey) {
          $(this).toggleClass('selected');  
    } else {
          $(".subject").removeClass("selected");
          $(this).addClass("selected");           
    }
    if (document.selection)
        document.selection.empty();
    else if (window.getSelection)
        window.getSelection().removeAllRanges();
});

Updated fiddle.

这篇关于在Firefox的奇怪的蓝色边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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