HTML5 Video autoplay on iPhone

Does playsinline attribute help? Here’s what I have: <video autoplay loop muted playsinline class=”video-background “> <source src=”https://stackoverflow.com/questions/43570460/videos/intro-video3.mp4″ type=”video/mp4”> </video> See the comment on playsinline here: https://webkit.org/blog/6784/new-video-policies-for-ios/

jQuery get the location of an element relative to window

Initially, Grab the .offset position of the element and calculate its relative position with respect to window Refer : 1. offset 2. scroll 3. scrollTop You can give it a try at this fiddle Following few lines of code explains how this can be solved when .scroll event is performed, we calculate the relative position … Read more

How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+?

I spent some time experimenting with this. It seems to sort of follow the new Clipboard API spec. You can define a “paste” event handler and look at event.clipboardData.items, and call getAsFile() on them to get a Blob. Once you have a Blob, you can use FileReader on it to see what’s in it. This … Read more

How to style HTML5 range input to have different color before and after slider?

Pure CSS solution: Chrome: Hide the overflow from input[range], and fill all the space left to thumb with shadow color. IE: no need to reinvent the wheel: ::-ms-fill-lower Firefox no need to reinvent the wheel: ::-moz-range-progress /*Chrome*/ @media screen and (-webkit-min-device-pixel-ratio:0) { input[type=”range”] { overflow: hidden; width: 80px; -webkit-appearance: none; background-color: #9a905d; } input[type=”range”]::-webkit-slider-runnable-track { … Read more

Preventing scroll bars from being hidden for MacOS trackpad users in WebKit/Blink

The appearance of the scroll bars can be controlled with WebKit’s -webkit-scrollbar pseudo-elementsĀ [blog]. You can disable the default appearance and behaviour by setting -webkit-appearanceĀ [docs] to none. Because you’re removing the default style, you’ll also need to specify the style yourself or the scroll bar will never show up. The following CSS recreates the appearance of … Read more

What does the shrink-to-fit viewport meta attribute do?

It is Safari specific, at least at time of writing, being introduced in Safari 9.0. From the “What’s new in Safari?” documentation for Safari 9.0: Viewport Changes Viewport meta tags using “width=device-width” cause the page to scale down to fit content that overflows the viewport bounds. You can override this behavior by adding “shrink-to-fit=no” to … Read more