472,800 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

background-image flicker

The first method I ever used for multiple state buttons was to create a
graphic for each button for each state: AboutUs_on, AbooutUs_over,
AboutUs_out, etc. That works great when there are just a few buttons.
I'm creating interfaces now with many more buttons than "just a few".

I solved the maintenance problem by having generic button images, one
for each state, and having them be background images for text
containers, DIVs in this case, defined in external stylesheets. On
mouseover, mouseout, etc, I swap the classnames.

This does a couple of things for me. One, it decreases maintenance
because there are fewer images to create and only text to maintain.
Two, I can change the look and feel of a set of buttons by changing
what stylesheeet is referenced.

The problem is that when the classes swap, the transition is not
seamless. There is a flicker as the images swap out.

I've tried using javascript to preload the images hoping the browser
would cache them, but it doesn't affect background images, and there is
still a flicker.

I've tried making the background-image include both "on" and "off"
images, using classes to change the position of the background so that
only the "on" portion or "off" portion shows, and there is still a
flicker.

I've tried clipping, which didn't flicker. However, it didn't change
the image either.

Opera and Firefox appear to handle the transition the best, but because
this is a retail app it has to work in all browsers. Has anyone else
encountered this problem and solved it, and if so, how?

You can see what I'm trying to do at
http://new.seritas.com/buttons.asp. Any help would be appreciated.

- Bill in Kansas City, MO

Oct 3 '06 #1
3 5584
did you try stacking them with zorder and swapping the visibility on
mouseover? since theyre both "there" to begin with, there really is no
swapping that has to take place, just make one visible, and the other not
visible.

<se******@hotmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
The first method I ever used for multiple state buttons was to create a
graphic for each button for each state: AboutUs_on, AbooutUs_over,
AboutUs_out, etc. That works great when there are just a few buttons.
I'm creating interfaces now with many more buttons than "just a few".

I solved the maintenance problem by having generic button images, one
for each state, and having them be background images for text
containers, DIVs in this case, defined in external stylesheets. On
mouseover, mouseout, etc, I swap the classnames.

This does a couple of things for me. One, it decreases maintenance
because there are fewer images to create and only text to maintain.
Two, I can change the look and feel of a set of buttons by changing
what stylesheeet is referenced.

The problem is that when the classes swap, the transition is not
seamless. There is a flicker as the images swap out.

I've tried using javascript to preload the images hoping the browser
would cache them, but it doesn't affect background images, and there is
still a flicker.

I've tried making the background-image include both "on" and "off"
images, using classes to change the position of the background so that
only the "on" portion or "off" portion shows, and there is still a
flicker.

I've tried clipping, which didn't flicker. However, it didn't change
the image either.

Opera and Firefox appear to handle the transition the best, but because
this is a retail app it has to work in all browsers. Has anyone else
encountered this problem and solved it, and if so, how?

You can see what I'm trying to do at
http://new.seritas.com/buttons.asp. Any help would be appreciated.

- Bill in Kansas City, MO

Oct 6 '06 #2
Thanks, but z-order doesn't work on background images. Image swapping
is easy, but it's what I'm trying to avoid for ease of maintenance.

The goal is to have one ON image and one OFF image shared by twenty
buttons with text caption overlayed. Possibly relative positioning,
but that's been problematic because there's no positioning used
anywhere else in the page.

Santos L Halper wrote:
did you try stacking them with zorder and swapping the visibility on
mouseover? since theyre both "there" to begin with, there really is no
swapping that has to take place, just make one visible, and the other not
visible.

<se******@hotmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
The first method I ever used for multiple state buttons was to create a
graphic for each button for each state: AboutUs_on, AbooutUs_over,
AboutUs_out, etc. That works great when there are just a few buttons.
I'm creating interfaces now with many more buttons than "just a few".

I solved the maintenance problem by having generic button images, one
for each state, and having them be background images for text
containers, DIVs in this case, defined in external stylesheets. On
mouseover, mouseout, etc, I swap the classnames.

This does a couple of things for me. One, it decreases maintenance
because there are fewer images to create and only text to maintain.
Two, I can change the look and feel of a set of buttons by changing
what stylesheeet is referenced.

The problem is that when the classes swap, the transition is not
seamless. There is a flicker as the images swap out.

I've tried using javascript to preload the images hoping the browser
would cache them, but it doesn't affect background images, and there is
still a flicker.

I've tried making the background-image include both "on" and "off"
images, using classes to change the position of the background so that
only the "on" portion or "off" portion shows, and there is still a
flicker.

I've tried clipping, which didn't flicker. However, it didn't change
the image either.

Opera and Firefox appear to handle the transition the best, but because
this is a retail app it has to work in all browsers. Has anyone else
encountered this problem and solved it, and if so, how?

You can see what I'm trying to do at
http://new.seritas.com/buttons.asp. Any help would be appreciated.

- Bill in Kansas City, MO
Oct 9 '06 #3
se******@hotmail.com wrote:
The goal is to have one ON image and one OFF image shared by twenty
buttons with text caption overlayed.
That javascript method is no way to go about it.

Suppose there is one image used for inactive and one for hover; try
something like this
a {
background: transparent url(off.gif) no-repeat 0% 0%;
color: #ffffff;
display: block;
height: 28px;
width: 300px;
}
a:hover {
background-image: url(on.gif);
}

Alternately use one image with a different "section" for each of the
pseudo selectors and set different values for the background-position
property rule for each pseudo state.

Search for css rollovers.

Also maybe reconsider the use of html table and div elements. Try
something like this

ul {
list-style-type: none;
}

li { margin: 0.1em 0; }

____markup____

<ul>
<li><a href="#">First Link</a></li>
<li><a href="#">Second Link</a</li>
</ul>

Louise
Oct 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Stanimir Stamenkov | last post by:
Here are two cases regarding inline-level elements' line-height, padding and background, which I doesn't understand: <div style="background: black; color: white; line-height: 1.5">...
1
by: CMAR | last post by:
I have a design of a frameless page on my practice website: http://home.ne.rr.com/thespar/designerN.htm The idea is to have a #left navigation bar which is absolutely positioned and which...
3
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
2
by: bissatch | last post by:
Hi, I am running a w3c CSS validation check on a site in development. I have many errors saying that my CSS is not valid because I have not defined the background-color but instead left it...
6
by: Francois Bonzon | last post by:
Any idea how I can launch a background task from a PHP script? For example, when a user posts on my message board, it may fire many e-mail notifications to other users, and other tasks. I want...
0
by: Jeb Hunter | last post by:
Well, how can I describe this succinctly? I have a page with DIVs that us background images to produce a border effect. It works perfectly well, but I want to make up (for now) 3 different...
2
by: darkpowrjd | last post by:
I've been trying to create a new navigation system for my site, and I got everything figured out except for one thing. Here is the CSS code I'm using right now: body { font: normal 10px Verdana,...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
7
by: arupfrancis | last post by:
Hi, I am trying to create a colored box using background images. I am able to do it easily using tables but doing it in divs is proving to be an issue. Moreover IE and Mozilla also seems to be...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.