小编ada*_*onk的帖子

在另一个git仓库中维护git repo

这是我想要的:

REPO-A
  /.git
  /otherFiles
  /REPO-B
    /.git
    /moreFiles
Run Code Online (Sandbox Code Playgroud)

我希望能够将所有 REPO-A的内容推送到REMOTE-A并且只将 REPO-B 推送到REMOTE-B.

可能?

git version-control github

106
推荐指数
5
解决办法
6万
查看次数

jQuery:如果在别处检测到点击,则隐藏弹出窗口

我试图隐藏div如果用户点击任何地方但弹出窗口或它的孩子.这是我到目前为止的代码:

$("body").click(function(){
    var $target = $(event.target);
    if(!$target.is(".popup") || !$target.is(".popup").children()){
        $("body").find(".popup").fadeOut().removeClass('active');
    }
});
Run Code Online (Sandbox Code Playgroud)

它适用于.popup div,但是如果它的任何一个孩子被点击,它仍会隐藏它.

jquery

39
推荐指数
2
解决办法
8万
查看次数

jQuery:检查元素是否具有CSS属性

有没有办法检查元素父级并找到第一个具有CSS背景设置然后返回该背景值的方法?

就像是:

var background = $('element').parents().has(css('background'));
Run Code Online (Sandbox Code Playgroud)

更新:这是我现在使用的代码:

jQuery.fn.getBg = function(){
    var newBackground = this.parents().filter(function() {
        return $(this).css('background-color').length > 0;
    }).eq(0).css('background-color');
    $(this).css('background-color',newBackground); console.log("new background is: "+newBackground);
};
Run Code Online (Sandbox Code Playgroud)

jquery

31
推荐指数
3
解决办法
6万
查看次数

IE9中<a>的边界半径错误

看到<div>元素正确渲染边框/边框半径,但任何<a><button>具有背景,边框和边框半径设置的元素都将背景颜色或图像显示为正方形,并且只有边框为圆形.尝试设置<a><button>display: blockdisplay: inline-block,但没有奏效.

有一个已知的解决方法吗?

以下是Webkit计算样式的链接:https://gist.github.com/773719

替代文字

这是IE9开发工具的计算样式: 替代文字

更新 使用过滤器:; 或-ms-filter:; IE中具有渐变的属性使背景突破定义的border-radius.

css css3 internet-explorer-9

13
推荐指数
1
解决办法
5525
查看次数

自定义jQuery过滤器需要优化

在下面的代码中,friendBlocks有800多个项目,如下所示:

<div class='block'>
    <span class='title'>Some Name</span>
    <img src='some.img' />
</div>
Run Code Online (Sandbox Code Playgroud)

我正试图用下面的代码过滤它们.它有效,但速度极慢,有时会崩溃浏览器.

friendBlocks = friendform.find('.block');
filterFriends = function(text) {
    friendBlocks.each(function() {
        var block;
        block = $(this);
        if (block.children('.title').text().toLowerCase().indexOf(text) >= 0) {
            block.show();
        } else {
            block.hide();
        }
    });
};
Run Code Online (Sandbox Code Playgroud)

有没有办法优化这个并更有效地进行搜索?

performance jquery filter

2
推荐指数
1
解决办法
238
查看次数