Solved

Need to animate buttons on webpage

Posted on 2014-11-21
8
228 Views
Last Modified: 2014-11-22
I have a web page with buttons as shown here:
All the Buttons
They work fine but there is no visual indication when the get clicked.  What is the best and quickest way for me to visually respond to a click?  Here is one of the buttons files as an example:

Back Button
For image tools I have Gimp though I am a novice with it.  I also have the Jquery and jqueryUI libraries working on this page if that's of any use.
0
Comment
Question by:canuckconsulting
  • 7
8 Comments
 
LVL 2

Expert Comment

by:Elxn
ID: 40458138
You can use jquery to do something like this easily.

Just give your images a class and a tabindex:
<img class="photo" tabindex="0" src="pic.jpg" />

Open in new window


Then use css to define a new image for your image when it has the focus (i.e. is clicked on).
.photo:focus{
   background:url(click-pic.jpg);
}

Open in new window


Then use jquery to remove the focus after a short period of time:
$( ".photo" ).click(function() {
    $(this).blur().delay(500);
});

Open in new window


That should probably be a really easy way to do this.
0
 
LVL 2

Expert Comment

by:Elxn
ID: 40458147
you'll probably want to use a unique ID instead of a class as you'll need various css for the different pictures.  Forgot to do that.  Just define css for each unique ID and you can change the code accordingly.

Or to make your life easier you can change the color of the class's css and just modify the way the image looks when they click on it.  Like so:

.photo:focus{
	filter: saturate(500%);
	-webkit-filter: saturate(500%);
	-moz-filter: saturate(500%);
	-o-filter: saturate(500%);
	-ms-filter: saturate(500%);
}

Open in new window


You won't have to mess around with all those ID's in your CSS if you do it this way...
0
 
LVL 2

Accepted Solution

by:
Elxn earned 500 total points
ID: 40458198
Oh I should also say I made a mistake in my first comment.  The CSS needs to be changed.

Change your focus css to:
.photo:focus{
   content:url("click-pic.jpg");
}

Open in new window


setting the background image was a mistake.. Sorry!

Here is a working example: example
0
 

Author Closing Comment

by:canuckconsulting
ID: 40459445
Thanks Nick!

Interestingly that doesn't work for IE but looks good in Chrome.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Expert Comment

by:Elxn
ID: 40460139
Hmm.  I'm pretty new to jQuery, but I am pretty sure jQuery works very hard to be cross-browser compatible so the problem is probably elsewhere.  My guess is that IE doesn't allow you to set a tab index for elements like a img tag.
0
 
LVL 2

Expert Comment

by:Elxn
ID: 40460148
Solution, just fake IE out by using links...  Check out the solution for IE here
0
 
LVL 2

Expert Comment

by:Elxn
ID: 40460150
and remember you should be able modify the saturation (or other aspects) with the CSS i already gave you in an earlier comment so you don't have to specify unique images for each button and button focus.
0
 
LVL 2

Expert Comment

by:Elxn
ID: 40460158
Oh just found out CSS filter support is not in IE... So forget that idea...
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The goal of the tutorial is to teach the user what gradient filters are and how to use them. When you have a photo and some part of the photo is either over exposed or under exposed, you use a gradient filter to help mask the need to touch up th…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now