Coder Social home page Coder Social logo

Comments (4)

ghinda avatar ghinda commented on May 26, 2024

I can't seem to be able to replicate this, and it definitely shouldn't happen, since it's just CSS on form elements.

Here's a screenshot of my Chrome Task Manager, on Kubuntu 13.04.
screenshot-high-cpu
The tab with the toggle switches is the last one, while the other one is Github.

Are you using any extensions that might be injecting additional js/css into the tab?

from css-toggle-switch.

micred avatar micred commented on May 26, 2024

As you can see in your screenshoot you get a 40% CPU usage for a tab that's already loaded (why 4 frame per second?!).

from css-toggle-switch.

ghinda avatar ghinda commented on May 26, 2024

It's most probably related to a bugfix for older versions of Webkit, which has an infinite animation.
https://github.com/ghinda/css-toggle-switch/blob/gh-pages/toggle-switch.css#L225-232

/* Bugfix for older Webkit, including mobile Webkit. Adapted from:
* http://css-tricks.com/webkit-sibling-bug/
*/
.switch, .toggle {
-webkit-animation: bugfix infinite 1s;
}

@-webkit-keyframes bugfix { from { position: relative; } to { position: relative; } }

I'll take a deeper look to see if this is the cause, and if it's possible to be removed.

from css-toggle-switch.

ghinda avatar ghinda commented on May 26, 2024

Yes, it seems that the infinite animation, required for the Webkit bugfix, is causing the high CPU usage.
Even if the bug has been fixed in newer versions of desktop browsers, I still need the bugfix for Android support (4.0 and bellow - I haven't tested 4.1 and 4.2) and probably older iOS support (but I haven't tested yet).

Removing the bugfix completely means giving up support for these, which is not really an option right now.

I tried a number of workarounds, like using hardware accelerated properties like 3d transforms - which does seem to resolve the high CPU issue in desktop Chrome, but makes the switches to stop working on Android (and also probably on older iOS and Webkit browsers).

I'll keep the issue open for now, while I look for a different bugfix.

from css-toggle-switch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.