Set Webkit Keyframes Values Using Javascript Variable

Okay, not what your actual code looks like, but you can’t throw JavaScript variables into CSS, it won’t recognize them. Instead, you need to create the CSS rules through JavaScript and insert them into the CSSOM (CSS Object Model). This can be done a few ways — you can either just create a keyframe animation … Read more

Proper way to optimize CSS 3 animations for iOS/Mobile Safari?

You should at minimum add an empty translate3d declaration: transform: translate3d(0,0,0); -webkit-transform: translate3d(0,0,0); This will help performance immensely on iOS, as demonstrated by Remy Sharp, because it causes iOS to use hardware-acceleration. If you want to go further, refactor the animation to use a webkit translation transform, rather than animating the ‘top’ property. In the … Read more

Swift 3 – Check if WKWebView has loaded page

Answer (Big thanks to @paulvs ) To check if your WKWebView has loaded easily implement the following method: import WebKit import UIKit class ViewController: UIViewController, WKNavigationDelegate { let webView = WKWebView() func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { print(“loaded”) } override func viewDidLoad() { super.viewDidLoad() let url = URL(string: “https://www.yourwebsite.com/”) ! let request = … Read more

JavaScript: How to know if a connection with a shared worker is still alive?

This is only as reliable as beforeunload, but seems to work (tested in Firefox and Chrome). I definitely favour it over a polling solution. // Tell the SharedWorker we’re closing addEventListener( ‘beforeunload’, function() { port.postMessage( {command:’closing’} ); }); Then handle the cleanup of the port object in the SharedWorker. e.ports[0].onmessage = function( e ) { … Read more

use transition on ::-webkit-scrollbar?

It is fairly easy to achieve using Mari M’s background-color: inherit; technique in addition with -webkit-background-clip: text;. Live demo; https://jsfiddle.net/s10f04du/ @media screen and (-webkit-min-device-pixel-ratio:0) { .container { overflow-y: scroll; overflow-x: hidden; background-color: rgba(0,0,0,0); -webkit-background-clip: text; transition: background-color .8s; } .container:hover { background-color: rgba(0,0,0,0.18); } .container::-webkit-scrollbar-thumb { background-color: inherit; } }

CSS3 transforms and transitions (Webkit)

Add the vendor prefix in the transitions: p { -webkit-transform: translate(-100%, 0); -moz-transform: translate(-100%, 0); -ms-transform: translate(-100%, 0); -o-transform: translate(-100%, 0); transform: translate(-100%, 0); -webkit-transition: -webkit-transform 1s ease-in; /* Changed here */ -moz-transition: -moz-transform 1s ease-in; -o-transition: -o-transform 1s ease-in; transition: transform 1s ease-in; } a:hover + p { -webkit-transform: translate(0, 0); -moz-transform: translate(0, 0); … Read more