SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery Change TR bgcolor

    Hi,

    I'm struggling to change the bg colour of my tr. So far I have:
    Code:
    <HEAD>
    <script type="text/javascript" src="includes/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="includes/jquery.color.js"></script>
    <script>
      $(document).ready(function(){
        $("#proplink").mouseover(function(){
      $("#proplink").animate( { backgroundColor: "#fce3ac" }, 600);
    });
    $("#proplink").mouseout(function(){
      $("#proplink").animate( { backgroundColor: "red" }, 600);
    });
      });
    </script>
    <style type="text/css">
    <!--
    .proplinko {
    	background-color: blue;
    }
    -->
    </style>
    </HEAD>
    
    <BODY>
    <tr valign="middle" id="proplink" onClick="document.location.href='property.php?id=".$id."';" class="proplinko" style=\"cursor:pointer;">
    </BODY>
    It seems to sort of work, but flashes between the 2 colour as if I'm quickly moving my mouse over and out.

    Any help would be appreciated.

    Rhys

  2. #2
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Done it.
    Code:
    <script>
      $(document).ready(function(){
        $('.proplinko').hover(function(){
      $(this).animate( {backgroundColor:'#fce3ac'}, 600);
    		},function(){
    			$(this).animate( {backgroundColor:'#f9f9e2'}, 600);
    		});
      });
    </script>
    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •