English 中文(简体)
如何在无冲突与争 j的情况下,以肤色1和肤色2的浮over为iv?
原标题:How to color a div on hover with color1 and onclick with color2 without conflicts with jquery?

我有一套干.。 他们在被点击时需要 o,在被点击时需要留在红色上(在被点击时,需要回去打白色)。 在被点击时,我需要让小夫“当选”(引出一个被挑选的新类别)。

问题在于,所有东西都行得当,但是,在被点击之后,一把一只 h子上, h似乎依然有效。 我的法典

$(document).ready(function () {

    $("div.onemovie").not("select").hover(
  function () {
          $(this).css("background-color", "Olive");

  },
  function () {
          $(this).css("background-color", "White");
      }

  );
iii

Click Code:

 $(document).ready(function () {
  $("div.onemovie").toggle(
  function () {
      $(this).toggleClass("select");
      $(this).css("background-color", "Red");
  },

  function () {
      $(this).toggleClass("select");
      $(this).css("background-color", "White");
  }
  );

iii

http://jsfiddle.net/mNsfL/“rel=”nofollow。 http://jsfiddle.net/mNsfL/。

最佳回答

这一版本是你想要的吗?

rel=“nofollow> http://jsfiddle.net/X7HbY/7/。

我认为,你可以更简单地利用中央支助事务来完成你们想要的东西。

Also, you shouldn t have to set the background color back to white. When the rule no longer applies, the div will revert to its former settings.

问题回答

我能看到的最好办法是对每一活动进行约束,并使它在模拟活动期间,如果点击<条码>div,则模拟活动就没有结合。

这将使停用法不执行,使<条码>div保留了彩色改动。

如果您使用j Query 1.7+,请您使用http://api.jquery.com/on"rel=“nofollow”>,对事件进行约束,并 to unbind)。

$("div.onemovie").bind( click , function(){
    $(this).css("background-color", "White");
})
.bind( mouseover , function() {
    $(this).css("background-color", "Red");
})

每一次活动都要进行清点,单独进行。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

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.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签