Html spin.js没有出现在iPhone/iPad上
我用于在加载新页面时显示微调器。因为IE在设置gif动画方面有问题,所以我使用这个库。现在我发现它在iOS上不起作用。旋转器根本没有出现。通过以下方式进行测试: 带iOS 6.1.3的iPhone 配备iOS 5.1.1的iPad 它适用于所有Windows浏览器,甚至Safari for Windows 标题: 在结束正文之前:Html spin.js没有出现在iPhone/iPad上,html,ios,css,css-position,Html,Ios,Css,Css Position,我用于在加载新页面时显示微调器。因为IE在设置gif动画方面有问题,所以我使用这个库。现在我发现它在iOS上不起作用。旋转器根本没有出现。通过以下方式进行测试: 带iOS 6.1.3的iPhone 配备iOS 5.1.1的iPad 它适用于所有Windows浏览器,甚至Safari for Windows 标题: 在结束正文之前: 我试着使用另一个元素。它在这里工作。问题在于位置:已修复。我听说iOS5确实支持这一点。我怎么在屏幕中间把旋转中心连在iOS上?该页面不是为移动设备明确构建的。它主要
我试着使用另一个元素。它在这里工作。问题在于位置:已修复。我听说iOS5确实支持这一点。我怎么在屏幕中间把旋转中心连在iOS上?该页面不是为移动设备明确构建的。它主要是一个桌面版本,但也应该适用于iOS。因为另一个解决方案不起作用,我不会使用我提出的JS解决方案框架。只需使用JS计算屏幕的中间部分:
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
}
$('#center').center();
摘自中的答案
一个缺点是:用户可以滚动远离微调器。您需要一些能够适应滚动的东西,如中所示
<div id ="center" style="position:fixed;top:50%;left:50%"></div>
<script>
var opts = {
lines: 13, // The number of lines to draw
length: 8, // The length of each line
width: 4, // The line thickness
radius: 11, // The radius of the inner circle
corners: 1, // Corner roundness (0..1)
rotate: 0, // The rotation offset
direction: 1, // 1: clockwise, -1: counterclockwise
color: '#000', // #rgb or #rrggbb or array of colors
speed: 1, // Rounds per second
trail: 60, // Afterglow percentage
shadow: false, // Whether to render a shadow
hwaccel: false, // Whether to use hardware acceleration
className: 'spinner', // The CSS class to assign to the spinner
zIndex: 2e9, // The z-index (defaults to 2000000000)
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};
var target = document.getElementById('center');
var spinner = new Spinner(opts);
$("#select-place input").click(function(){
spinner.spin(target);
});
$(window).bind("load", function() {
spinner.stop();
});
</script>
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
}
$('#center').center();