New Posts
Welcome guest, is this your first visit?
  • Login:
PokerPlayerCafe.com Poker Affiliate Program
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    DropoutGotRich.com
    My Personal Blog URL Above!
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada
    Posts
    1,938
    Blog Entries
    32
    Feedback Score
    39 (100%)

    Default Change Button Color (Mouseover)

    If I have two identical buttons but different colors how do I go abouts making it change colors when someone puts the mouse cursor over the button?

    Is there code that goes in the css to do this?

    Thanks!

  2. #2
    MPC
    MPC is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada Eh?
    Posts
    1,376
    Blog Entries
    20
    Feedback Score
    8 (100%)

    Default

    Not done via CSS. Here's the code:

    PHP Code:
    <a href="http://yoururl.com/"><img src="http://url to image #1" alt="" width="xxx" height="xx" onmouseover="this.src='http://url to image #2'" onmouseout="this.src='http://url to image #1'"/></a
    Note that the "URL to image #1" goes two places.

  3. #3
    DropoutGotRich.com
    My Personal Blog URL Above!
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada
    Posts
    1,938
    Blog Entries
    32
    Feedback Score
    39 (100%)

    Default

    Thanks buddy will give that a shot!

  4. #4
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    448
    Feedback Score
    6 (100%)

    Default

    It should be done with css not like that, and if you want it really good you have the two buttons in the same image so you dont get a delay.

    Just search "css hover sprite" or something.
    Gambling Revolutions

    Are you in need of nice looking poker chips? or maybe something else
    Gambling Products Recreation

    Swedish poker site with poker bonus and reviews.

  5. #5
    MPC
    MPC is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada Eh?
    Posts
    1,376
    Blog Entries
    20
    Feedback Score
    8 (100%)

    Default

    Quote Originally Posted by sirtiner View Post
    It should be done with css not like that, and if you want it really good you have the two buttons in the same image so you dont get a delay.

    Just search "css hover sprite" or something.
    Yes, that's the harder (but better) way to do it. This is what it does essentially: What appears to be two images is actually just one image that is partially exposed. So imagine you have a 200px by 100px rectangle image. The first half is white, the second half is black. The CSS code would basically say "show the first half by default and on mouse over, show the second half instead". The advantage to using this method is that there is only one image being loaded, so it's faster.

    I actually attempted to build my entire template using a CSS sprite once. The idea is that only one big image would load, and then it gets cached. The site takes that single images and exposes portions of it where needed in the template. That would have a huge impact on load times. I wasn't able to get it working 100% cross browser so I gave up on it. But if you are interested to learn more, check out CSS Sprites: What They Are, Why They’re Cool, and How To Use Them | CSS-Tricks for an excellent read. Then once you understand the concept, try out SpriteMe. You'll have to go through the demo to better understand the functions.

  6. #6
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    448
    Feedback Score
    6 (100%)

    Default

    Was that to me? I already know it ins and outs. But thx anyways.

    About your cross browser problem, there should not be a problem unless you tried it like years ago. like you said, less http request the better, thats what makes a site fast.
    Gambling Revolutions

    Are you in need of nice looking poker chips? or maybe something else
    Gambling Products Recreation

    Swedish poker site with poker bonus and reviews.

  7. #7
    MPC
    MPC is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Canada Eh?
    Posts
    1,376
    Blog Entries
    20
    Feedback Score
    8 (100%)

    Default

    Quote Originally Posted by sirtiner View Post
    Was that to me? I already know it ins and outs. But thx anyways.
    Not it was to anyone who's interested! But now you've peaked my curiosity. I might bug you about this when I try again if that's OK with you

  8. #8
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    448
    Feedback Score
    6 (100%)

    Default

    sure thing, just give me a pm
    Gambling Revolutions

    Are you in need of nice looking poker chips? or maybe something else
    Gambling Products Recreation

    Swedish poker site with poker bonus and reviews.

  9. #9
    CK
    CK is offline
    Senior Member
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    ?
    Posts
    2,203
    Blog Entries
    2
    Feedback Score
    35 (100%)

    Thumbs up

    Was that to me? I already know it ins and outs. But thx anyways.
    And if you want someone who is kick ass at working with sprites I would higher sirtiner. Absolutely 100% awesome to work with
    ----------------------------------------
    Everyone says they are willing to do whatever it takes to get ahead - but yet there are so few people up at 5AM ? - Robert Herjavec
    ---------------------------------------

  10. #10
    Member
    My Status
     

    Add as a friend
    Join Date
    Oct 2009
    Location
    US
    Posts
    52
    Feedback Score
    1 (100%)

    Default

    Using CSS sprites is super simple with a hover over button. Just take your block that you want the button to be,

    PHP Code:
    <div class="button"></div
    Then put a background in it

    PHP Code:
    .button {
      
    backgroundtransparent url(where/your/button/is.png0px 0px;
      
    height100px;
      
    width100px;

    Now just change the background position when it is hovered over

    PHP Code:
    .button:hover {
      
    background-position: -100px 0px;

    That's it.


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Powered by vBulletin® Version 4.1.5
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 3.6.0
Affiliate Program Consultant
Live threads provided by AJAX Threads (Lite) - vBulletin Mods & Addons Copyright © 2012 DragonByte Technologies Ltd. Runs best on HiVelocity Hosting.