English 中文(简体)
甚至在被捆绑后进行 h工作(点击)?
原标题:Make the hover work even after a jquery bind( click )?

基本上,甚至在被点击之后,我就想进行 h工作,但我把.26和27打到了不实的背景。 首先,当被点击时,由于我重新把它推回违约状态,就不再工作。

是否有更好的办法? 如果我不把其他图像放在其违约位置上,那么所有这些图像都将被点击。

Working sample: http://jsfiddle.net/louiemiranda/RkM3t/

The jquery Code:

$(".image22").bind("click", function(event){
    $(this).css("background-position", "0 100%");
    $( #package22 ).attr("checked", "checked");
    $( .image26 ).css("background-position", "0 0");
    $( .image27 ).css("background-position", "0 0");
    var cashcredit = $( #package22 ).val();
    $( #fyi ).html(cashcredit);
});

$(".image22").bind("mouseenter mouseleave", function(event){
    $(this).toggleClass("image22-selected");
});

感谢任何帮助。 感谢!

问题回答

你们的法典很多,但我认为这是你们想要的吗? http://jsfiddle.net/locrizak/LqWxt/

页: 1 (a) 期望通过乞讨方式改变的财产:image22-s selected等级;css property is used as inline作案,从而获得相对于阶级规则的优先权。

您可以删除<条码>背后位置,在组别之前将财产入账。 这样,就不会有条理。

然而,我认为,实现这一点的更明智的方法是使用另一个类别的名称,例如<代码>image22-hover,并按这一顺序界定规则:

image22 {
    background-image: url(your-image-22);
    background-position: 0 0;
}

image22-hover {
    background-position: move to a grey version of the image.
}

image22-selected {
    background-position: move to a selected version of the image.
}

image22-selected.image22-hover {
    background-position: move to a grey-selected version of the image.
}

Note that chained CSS classes selectors (the last selector) don t work in IE6: http://www.ryanbrill.com/archives/multiple-classes-in-ie/





相关问题
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.

热门标签