简体   繁体   中英

iOS7 Safari change webkit-overflow-scrolling background color

In a Cordova iPad App for iOS7, I have a DIV (.scrollContainer) with fixed height into which I'm putting some much taller content, and I'm allowing that contained content to scroll like this:

.scrollContainer
{
    width: 512px;
    height: 546px;
    overflow: hidden;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    background-color: #fff !important;
}

#content
{
    width: 512px;
    background-color: #fff;
}

The user can scroll the nested content nicely in the touch interface, but the user can also scroll 'past' the end of the content above or below as per the iOS 7 interface (ie it snaps back when they let go).

The background colour revealed as they over-scroll is black . Is there any way to set this to a different colour using CSS?

Faced the same problem today (iOS 7.1), seems like a glitch or something,

Adding borders or padding seems to fix it, allowing you to set a background color for the element itself. I sorted it out with this trick:

padding-top:1px;
margin-top:-1px;

Another solution would be to leave background unset on .scrollContainer element, and set it for its parent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM