Using background-attachment:fixed in safari on the ipad

前端 未结 7 499
误落风尘
误落风尘 2020-11-30 05:51

I\'m looking to recreate an effect similiar to the popular science app. Basically have one big background image and then have HTML/CSS layer on top of that. When the user sc

7条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 06:44

    I'm not that profi one, but I've solved this problem usin' jquery. It's quite simple) Here is the code:

    	jQuery(window).scroll(function(){
    		var fromtop = jQuery(window).scrollTop();
    		jQuery(" your element ").css({"background-position-y": fromtop+"px"});
    	});

提交回复
热议问题