将活动指示器放置到单元格的JavaScript代码 [英] JavaScript code to place activity indicator to a cell

查看:103
本文介绍了将活动指示器放置到单元格的JavaScript代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码(没有我自己的代码)将图像加载到css元素(称为单元格)并显示活动指示器。

I am using the following code(no my own code) to load image to a css element (called cell) and to display an activity indicator.

var cell = document.createElement('li');
cell.textContent = this.labelForIndex(index);
var indicator = new NKActivityIndicator(); 
indicator.init(10,100,20,"white");
indicator.show(); 
indicator.spin();
$(cell).css("background-image", "url("+iconImage+")"); 

现在我想将指标放在单元格的中间。 $ c> indicator.init(10,100,20,white); 定义指标的位置宽度和颜色。

Now i want to place the indicator in the middle of the cell.this line of code indicator.init(10,100,20,"white");define the position width and color of indicator. I want to place it int the mid of cell.Any kind to response?

推荐答案

你可以使用jQuery的。position()。offset()以检索单元格的位置,并使用.height()和.width(),您可以将组件放在单元格的中间。

You can use jQuery's .position() or .offset() to retrieve the position of the cell and with the use of .height() and .width(), you can place the component in the middle of the cell.

这篇关于将活动指示器放置到单元格的JavaScript代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆