Skip to main content

Hi,

 

Got a Toolbar button on a list.

 

The button background is the same as the list, i want it to standout.

 

So i changed the background of the button, but then it's completely flat and when the user hovers over it, nothing moves.

 

Is there a way to make the Tollbar Button Background/Font colour change as the mouse hovers over it?

 

I like my stuff to be user friendly :-)

Hi Sharpharp1,


 


Simple way to do it:


 


<script>

$(".button-text").hover(function() {

$(this).css({'color':'red'});

}, function() {

$(this).css({'color':'black'});

});
</script>

This will apply on all toolbar buttons


Looking good, for completion, can the Toolbar button background colour be changed as well? :-)


I would add a border instead of changing the background color


 


To add border


 


$(".button-text").hover(function() { 

$(this).css({"color": "red"});
$(this).parent().css({"color": "red", "border": "2px solid red"});

}, function() {
$(this).css({"color": "black"});
$(this).parent().css({"color": "red", "border": "0px"});

});

If you want to change the background color


 


$(".button-text").hover(function() { 

$(this).css({"color": "red"});
$(this).parent().css({"color": "red", "background-color":'yellow'});

}, function() {
$(this).css({"color": "black"});
$(this).parent().css({"color": "red", "background-color":"#e4e7dd"});

});

This script is what I needed to provide some additional emphasis on the buttons - but I'm having some issues where the text is turning white after they click on the button.  

 

I've tried some onclick function but then it stays in that state after clicking on another button.

 

Any suggestions on this?  I am not an advanced JAVA developer - so I'm relying on these posts to push me in the right direction, which they have but I get stuck in some areas still.

 

THANK YOU!



Reply