ImonFyre
ImonFyre

Reputation: 41

iOS9 UIWebView/Chrome CSS transitions

While working on making our website responsive, I implemented a menu system along the lines of this - http://www.sitepoint.com/pure-css-off-screen-navigation-menu/

Everything was going swimmingly until we updated our test iPhone 6 from iOS 8 to iOS 9. Safari continues to work properly, but Chrome and our app which uses a UIWebView, will not render the slide transition, unless I go in and manually toggle something using the Safari web inspector.

I have tried the suggestions from Safari on iOS 9 does not trigger click event on hidden input file, but it had no effect.

I also know about the javascript location/hash bug, but am not sure if that is something that is related.

Has anyone encountered something like this, and found a way around it or a way to fix it? Updating to Safari Web View is currently not an option.

Upvotes: 0

Views: 2101

Answers (1)

ImonFyre
ImonFyre

Reputation: 41

A solution has been found. It turns out that iOS 9 UIWebView, as of 9.0.2, has broken the ~ (tilde) selector.

In order to get around this, I had to be a lot less general with my code, and use the CSS + (plus) selector to get the selectors that I need doing stuff to work.

This is a very basic representation of what I have working as my menu.

<input type="checkbox" class="nav-trigger" id="nav-trigger" />
<nav class="MobileMenu" />
<div class="Content">
    <label for="nav-trigger"/>
</div>

the styles controlling it before iOS9

<style>
    .Content
    {
        width: 100%;
        height: 100%; /*background-color: #fff;*/
        position: relative;
        top: 0;
        bottom: 100%;
        left: 0;
        z-index: 1;
    }
    nav.MobileMenu
    {
        list-style: none;
        width: 60%;
        height: 100%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 0;
    }
    nav.MobileMenu
    {
        display: none;
        overflow-y: scroll;
    }
    label[for="nav-trigger"]
    {
        position: absolute;
        margin: 7px 0 0 10px;
        width: 30px;
        height: 30px;
        cursor: pointer;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='https://www.w3.org/1999/xlink' version='1.1' x='0px' y='0px' width='30px' height='30px' viewBox='0 0 30 30' enable-background='new 0 0 30 30' xml:space='preserve'><rect width='30' height='6'/><rect y='24' width='30' height='6'/><rect y='12' width='30' height='6'/></svg>");
        background-size: contain;
    }
    .nav-trigger:checked ~ nav.MobileMenu
    {
        display: block;
    }
    .nav-trigger:checked ~ div.NotMenu
    {
        -webkit-transform: translate(60%,0);
        -moz-transform: translate(60%,0);
        -ms-transform: translate(60%,0);
        -o-transform: translate(60%,0); /*transform: translate(60%,0);*/
        transform: translate(60%,0); /*left: 60%;*/
        box-shadow: 0 0 5px 5px rgba(0,0,0,0.5);
    }
    .nav-triggerLink:checked ~ ul.level0
    {
        visibility: hidden;
    }
    .NotMenu
    {
        -webkit-transition: -webkit-transform 0.3s ease-out;
        -moz-transition: transform 0.3s ease-out;
        -o-transition: transform 0.3s ease-out;
        transition: transform 0.3s ease-out; 
    }
</style>

changed css

.nav-trigger:checked + nav.MobileMenu
{
    display: block;
}
.nav-trigger:checked + nav.MobileMenu + div.Content
{
    -webkit-transform: translate(60%,0);
    -moz-transform: translate(60%,0);
    -ms-transform: translate(60%,0);
    -o-transform: translate(60%,0); /*transform: translate(60%,0);*/
    transform: translate(60%,0); /*left: 60%;*/
    box-shadow: 0 0 5px 5px rgba(0,0,0,0.5);
}

Upvotes: 2

Related Questions