English 中文(简体)
检测 j子中的 coll子
原标题:Detect colliding elements in jQuery

我目前正在努力制定类似于SOS联系人的申请。 风格如此,现在就确实很重要,但我要让这一功能发挥作用。

I have set up a jsFiddle to show what I m trying to achieve (http://jsfiddle.net/hpQVy/), and here s the code:

<>光>:

<ul class="divided">
    <li class="divider">A</li>
    <li>Andrew Acheson</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li>Luke Ayre</li>
    <li class="divider">B</li>
    <li class="divider">C</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
    <li>Charlie Sheen</li>
</ul>

JavaScript:

$(function() {
    // First off, dock the first one:
    $( ul.divided li.divider ).eq(0).css({ position:  fixed  });
    $(window).scroll(function() {

        //

    });
});

<>CSS:

body {
    padding: 0;
    margin: 0;
}
ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: Arial;
}
    ul li {
        padding: 10px;
        border-bottom: 1px solid #000;
        width: 100%;
        box-sizing: border-box;
    }
        ul li.divider {
            font-weight: bold;
            padding: 2px 10px;
            background-color: #aaa;
            color: #fff;
            text-shadow: 0 1px 0 #000;
            opacity: 0.7;
        }

我想做的是模拟对名单分裂者的 do弄。 我的思想是,在任何分裂者与被打碎的分裂者串通时,先发现他们,然后是这样。 我的问题一是,在名单分配者()与li.divider串通时,如何发现这种差距的最佳方式。 具有<代码>的位置:固定。 我需要探测高层和底层的碰撞(如果是这样的话)。

是否有任何人建议采用一种方法在<代码>li要素可能串通时进行检测?

最佳回答

ok maybe this isn t the response You are at, but have a look at this plugin。 我认为,这只是你试图制造的东西。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签