javascript - background-attachment: fixed + background-size: cover on Ipad? -
i have block height 100%, , scrolles down single mouse wheel (i mousewheel.js). in block have 2 other blocks height , width 100%, , background images changes fade effect. set background-size: cover
, background-attachment: fixed
blocks. working fine on desktop browsers. on ipad have issues:
.first-block { background-size: cover; background-attachment: fixed; position: absolute; -webkit-transition: opacity 2s ease-in; transition: opacity 2s ease-in; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; height: 100%; width: 100%; visibility: hidden; opacity: 0; top: 0; }
fixed
,cover
dont work, images zoomed.. decided setbackground-attachment: scroll
, emulatebackground-attachment: fixed
jquery adding code$(window).scroll(function() { var scrolledy = $(window).scrolltop(); $('.first-block').css('background-position', 'center ' + ((scrolledy)) + 'px'); });
its working fine, on ipad , safari (mac os) work slow.. crash browser..
when change orientation of display in ipad - background dont reconstructed each orientation. display img size first orientation.
i have read many many similar questions here, cant find better solution me. please see jsfiddle demos.
thanks help.
i'm not expert when comes understanding many scripts, can tell pretty solve issue entirely. when use scripts such mousewheel.js, you're going find out handheld devices , tablets react quite bit differently desktop browsers would.
as far lag you're experiencing, that's due limitation of device on. i'm sure if try on other tablets, you'd find similar results this. best solution optimizing website using media queries can ensure although users have experience you're intending, tablet users can still access needed information , essential site functionality.
things like:
@media (min-width: 700px) , (orientation: landscape) { ... }
and:
@media (min-width: 700px) { ... }
will let code css specific conditions in css. can find resource here:
https://developer.mozilla.org/en-us/docs/web/guide/css/media_queries
i suggest if you're looking keep wanted, i'd take experimenting other js files same thing.
sorry if provided doesn't give exact solution need.
Comments
Post a Comment