开发者

Is there a way to make JavaScript change the text size when you zoom?

When you zoom in with the Android, all the text of a paragraph changes size so each line of the paragraph fits into the screen, but if you zoom in too much, the paragraph gets too tall and basically falls off the background image (set with Z-indexing, so behind that there is a white background that isn't supposed to be there). 开发者_如何学运维So is there any way to pick up a zoom event so that when you zoom in the text gets smaller so the paragraph stays the same height?


I haven't tested this, but try biding to the resize and scroll events in JavaScript. Here is an example in jQuery:

$(window).bind("touchstart touchend resize scroll",function(){
    $("#background").css({
        top:$("body").scrollTop(),
        left:$("body").scrollLeft(),
        width:$(window).width(),
        height:$(window).height()
    });
});

I have also added to the touchstart and touchend events so that it works on iDevices too. Ad@m

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜