Firefox: First Time Hover BlinkCSS selector for first element with classMake the cursor a hand when a user hovers over a list itemSee :hover state in Chrome Developer ToolsChrome / Safari image loader, first time openingHow to make Twitter Bootstrap menu dropdown on hover rather than clickHow to make blinking/flashing text with CSS 3?Pan a large image inside a div without using mouseoverBubble - content overflowingImage flickers on first hover with transform:scale (in Firefox only)Image preloading techniques (for use as hover state CSS background images) don't seem to work on Chrome

Robbers: The Hidden OEIS Substring

How might the United Kingdom become a republic?

Why isn't there research to build a standard lunar, or Martian mobility platform?

Do native speakers use ZVE or CPU?

Dropping outliers based on "2.5 times the RMSE"

Why did the Japanese attack the Aleutians at the same time as Midway?

Machine learning and operations research projects

What's a moment that's more impactful on a reread called?

PIC12F675 GP4 doesn't work

How can one write good dialogue in a story without sounding wooden?

Are neural networks prone to catastrophic forgetting?

QGIS Welcome page: What is 'pin to list' for?

Can I play a first turn Simic Growth Chamber to have 3 mana available in the second turn?

Are there any intersection of Theory A and Theory B?

When did the Roman Empire fall according to contemporaries?

Is purchasing foreign currency before going abroad a losing proposition?

Would letting a multiclass character rebuild their character to be single-classed be game-breaking?

During copyediting, journal disagrees about spelling of paper's main topic

What does the standard say about char arrays as template arguments?

As a DM, how to avoid unconscious metagaming when dealing with a high AC character?

Why are Hobbits so fond of mushrooms?

Keep milk (or milk alternative) for a day without a fridge

How to check the quality of an audio sample?

Can I use "candidate" as a verb?



Firefox: First Time Hover Blink


CSS selector for first element with classMake the cursor a hand when a user hovers over a list itemSee :hover state in Chrome Developer ToolsChrome / Safari image loader, first time openingHow to make Twitter Bootstrap menu dropdown on hover rather than clickHow to make blinking/flashing text with CSS 3?Pan a large image inside a div without using mouseoverBubble - content overflowingImage flickers on first hover with transform:scale (in Firefox only)Image preloading techniques (for use as hover state CSS background images) don't seem to work on Chrome






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm trying to change the background-image of an element on mouseover, and it works all fine and dandy in Chrome. But in Firefox it always blinks/flickers for a split second on the very first hover after loading the page.



I've already pre-loaded the images that are needed on body:after, and the developer console in Firefox shows that there is a "GET" request for the file in question. Yet it doesn't seem to be ready to get rendered on the first mouseover.



This is how I pre-load the image.



body:after 
position: absolute;
width: 0;
height: 0;
overflow: hidden;
z-index: -1;
content: url(image.png);



I don't understand, why it's working flawlessly in Chrome, but Firefox produces the first-time flicker regardless of pre-loading or not. I do know about image sprites, but in my case, it's not a possibility.










share|improve this question
























  • can u make a demo fiddle

    – NIsham Mahsin
    Mar 26 at 4:33











  • please create a code snippet of your working code. thanks

    – Xenio Gracias
    Mar 26 at 4:50











  • I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

    – 04FS
    Mar 26 at 8:01












  • Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

    – Roy
    Mar 26 at 18:34

















1















I'm trying to change the background-image of an element on mouseover, and it works all fine and dandy in Chrome. But in Firefox it always blinks/flickers for a split second on the very first hover after loading the page.



I've already pre-loaded the images that are needed on body:after, and the developer console in Firefox shows that there is a "GET" request for the file in question. Yet it doesn't seem to be ready to get rendered on the first mouseover.



This is how I pre-load the image.



body:after 
position: absolute;
width: 0;
height: 0;
overflow: hidden;
z-index: -1;
content: url(image.png);



I don't understand, why it's working flawlessly in Chrome, but Firefox produces the first-time flicker regardless of pre-loading or not. I do know about image sprites, but in my case, it's not a possibility.










share|improve this question
























  • can u make a demo fiddle

    – NIsham Mahsin
    Mar 26 at 4:33











  • please create a code snippet of your working code. thanks

    – Xenio Gracias
    Mar 26 at 4:50











  • I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

    – 04FS
    Mar 26 at 8:01












  • Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

    – Roy
    Mar 26 at 18:34













1












1








1








I'm trying to change the background-image of an element on mouseover, and it works all fine and dandy in Chrome. But in Firefox it always blinks/flickers for a split second on the very first hover after loading the page.



I've already pre-loaded the images that are needed on body:after, and the developer console in Firefox shows that there is a "GET" request for the file in question. Yet it doesn't seem to be ready to get rendered on the first mouseover.



This is how I pre-load the image.



body:after 
position: absolute;
width: 0;
height: 0;
overflow: hidden;
z-index: -1;
content: url(image.png);



I don't understand, why it's working flawlessly in Chrome, but Firefox produces the first-time flicker regardless of pre-loading or not. I do know about image sprites, but in my case, it's not a possibility.










share|improve this question
















I'm trying to change the background-image of an element on mouseover, and it works all fine and dandy in Chrome. But in Firefox it always blinks/flickers for a split second on the very first hover after loading the page.



I've already pre-loaded the images that are needed on body:after, and the developer console in Firefox shows that there is a "GET" request for the file in question. Yet it doesn't seem to be ready to get rendered on the first mouseover.



This is how I pre-load the image.



body:after 
position: absolute;
width: 0;
height: 0;
overflow: hidden;
z-index: -1;
content: url(image.png);



I don't understand, why it's working flawlessly in Chrome, but Firefox produces the first-time flicker regardless of pre-loading or not. I do know about image sprites, but in my case, it's not a possibility.







css css3 css-animations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 13:00









Clyde Lobo

7,9595 gold badges30 silver badges53 bronze badges




7,9595 gold badges30 silver badges53 bronze badges










asked Mar 26 at 4:29









RoyRoy

63 bronze badges




63 bronze badges












  • can u make a demo fiddle

    – NIsham Mahsin
    Mar 26 at 4:33











  • please create a code snippet of your working code. thanks

    – Xenio Gracias
    Mar 26 at 4:50











  • I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

    – 04FS
    Mar 26 at 8:01












  • Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

    – Roy
    Mar 26 at 18:34

















  • can u make a demo fiddle

    – NIsham Mahsin
    Mar 26 at 4:33











  • please create a code snippet of your working code. thanks

    – Xenio Gracias
    Mar 26 at 4:50











  • I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

    – 04FS
    Mar 26 at 8:01












  • Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

    – Roy
    Mar 26 at 18:34
















can u make a demo fiddle

– NIsham Mahsin
Mar 26 at 4:33





can u make a demo fiddle

– NIsham Mahsin
Mar 26 at 4:33













please create a code snippet of your working code. thanks

– Xenio Gracias
Mar 26 at 4:50





please create a code snippet of your working code. thanks

– Xenio Gracias
Mar 26 at 4:50













I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

– 04FS
Mar 26 at 8:01






I don’t know if I could be bothered to pre-render an image either, if you told me upfront the space in which I should do so was 0 x 0 pixels.

– 04FS
Mar 26 at 8:01














Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

– Roy
Mar 26 at 18:34





Yeah, you're right 04FS. Modern browsers probably do too many "smart decisions" for a simple pre-loading trick like this. After all this I'm going for an image sprite regardless of my last statement in the original post.

– Roy
Mar 26 at 18:34












1 Answer
1






active

oldest

votes


















2














Even if it's already loaded from server, if some additional delay is seen then I would instead put both images (stacked or side-by-side) into a single image a.k.a. spritesheet.



Then on hover, shift the background-position to reveal the other half of the image.



For example, if the images are each 50x50, you could make one 100x50 image with both side-by-side. Let the normal state show the left half only (by keeping the element width to 50 and background-position 0 0) and then slide the background 50px left on hover, to reveal the right half:



background-position: -50px 0;





share|improve this answer























  • Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

    – Chris Barr
    Mar 26 at 13:03






  • 1





    The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

    – Roy
    Mar 26 at 18:36











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349873%2ffirefox-first-time-hover-blink%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Even if it's already loaded from server, if some additional delay is seen then I would instead put both images (stacked or side-by-side) into a single image a.k.a. spritesheet.



Then on hover, shift the background-position to reveal the other half of the image.



For example, if the images are each 50x50, you could make one 100x50 image with both side-by-side. Let the normal state show the left half only (by keeping the element width to 50 and background-position 0 0) and then slide the background 50px left on hover, to reveal the right half:



background-position: -50px 0;





share|improve this answer























  • Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

    – Chris Barr
    Mar 26 at 13:03






  • 1





    The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

    – Roy
    Mar 26 at 18:36
















2














Even if it's already loaded from server, if some additional delay is seen then I would instead put both images (stacked or side-by-side) into a single image a.k.a. spritesheet.



Then on hover, shift the background-position to reveal the other half of the image.



For example, if the images are each 50x50, you could make one 100x50 image with both side-by-side. Let the normal state show the left half only (by keeping the element width to 50 and background-position 0 0) and then slide the background 50px left on hover, to reveal the right half:



background-position: -50px 0;





share|improve this answer























  • Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

    – Chris Barr
    Mar 26 at 13:03






  • 1





    The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

    – Roy
    Mar 26 at 18:36














2












2








2







Even if it's already loaded from server, if some additional delay is seen then I would instead put both images (stacked or side-by-side) into a single image a.k.a. spritesheet.



Then on hover, shift the background-position to reveal the other half of the image.



For example, if the images are each 50x50, you could make one 100x50 image with both side-by-side. Let the normal state show the left half only (by keeping the element width to 50 and background-position 0 0) and then slide the background 50px left on hover, to reveal the right half:



background-position: -50px 0;





share|improve this answer













Even if it's already loaded from server, if some additional delay is seen then I would instead put both images (stacked or side-by-side) into a single image a.k.a. spritesheet.



Then on hover, shift the background-position to reveal the other half of the image.



For example, if the images are each 50x50, you could make one 100x50 image with both side-by-side. Let the normal state show the left half only (by keeping the element width to 50 and background-position 0 0) and then slide the background 50px left on hover, to reveal the right half:



background-position: -50px 0;






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 5:14









adamsimadamsim

1064 bronze badges




1064 bronze badges












  • Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

    – Chris Barr
    Mar 26 at 13:03






  • 1





    The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

    – Roy
    Mar 26 at 18:36


















  • Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

    – Chris Barr
    Mar 26 at 13:03






  • 1





    The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

    – Roy
    Mar 26 at 18:36

















Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

– Chris Barr
Mar 26 at 13:03





Agreed, using the "sliding doors" technique like this would be easier, less code, work everywhere, and less HTTP requests for images

– Chris Barr
Mar 26 at 13:03




1




1





The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

– Roy
Mar 26 at 18:36






The reason I didn't want to use an image sprite is because I was planning for a background transition to be added later. And it looks really weird if you do that with an image sprite. But I've found a way to do it regardless (in this article): gordonlesti.com/css-background-transitions-with-image-sprites

– Roy
Mar 26 at 18:36







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349873%2ffirefox-first-time-hover-blink%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?