阿贾克斯定位
我有 ajax 代码显示在该 div 顶部和左侧的某个 div 中,但是如何将 ajax 动画定位在该 div 的中间和中心?
<script language="javascript">
function visiontype_kamp(type,_link_)
{
var url_str = "index.cfm?fuseaction=objects2.emptypopup_get_vision_tabbed&is_property_vision="+type+"&&vision_position=1&mode=1&dongu=9&is_sale=0&vision_image_display=1&is_vision_prices=1&is_vision_product_name=1&is_vision_product_detail=1&is_vision_product_detail2=0&vision_image_width=50&vision_image_height=45&this_row_id_=kamp"
AjaxPageLoad(url_str,'vision_icerik_kamp' ,0,'',_link_);
}
</script>
这是 div:
<div id="vision_icerik_kamp"></div>
i have the ajax code that is displayed in some div at the very top and left side of this div, but how i can position the ajax animation in the middle and center of this div?
<script language="javascript">
function visiontype_kamp(type,_link_)
{
var url_str = "index.cfm?fuseaction=objects2.emptypopup_get_vision_tabbed&is_property_vision="+type+"&&vision_position=1&mode=1&dongu=9&is_sale=0&vision_image_display=1&is_vision_prices=1&is_vision_product_name=1&is_vision_product_detail=1&is_vision_product_detail2=0&vision_image_width=50&vision_image_height=45&this_row_id_=kamp"
AjaxPageLoad(url_str,'vision_icerik_kamp' ,0,'',_link_);
}
</script>
and this is the div:
<div id="vision_icerik_kamp"></div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你的div有预定义的尺寸,这很简单,因为我假设它没有,那么这意味着它没有尺寸,所以没有办法找到像中间这样的东西,你有一个中心,因为它是一个跨越尽可能多的块可以,但是它没有高度,所以你要做的就是首先通过 javascript 设置高度,然后将动画 gif 作为背景图像,并通过 javascript 将背景位置设置为中心高度/2px,这它应该如何工作。
document.getElementById("vision_icerik_kamp").style.height = '100px';
document.getElementById("vision_icerik_kamp").style.backgroundImage = "./image/url.gif";
document.getElementById("vision_icerik_kamp").style.backgroundPosition = "中心 20px";
我不知道 x 坐标是第一个还是 y 坐标,无论如何这将是一个想法,我认为 div 不应该绝对为空,你应该放置一个 在里面
It is simple if your div has predefined dimensions, as I assume it does not then it means it has no dimensions so there si no way of finding such thing as middle, you've got a center as it is a block spanning as much as it can, but it has no height, so what you have to do is first of all set a height on it via javascript, then place the animating gif as background image and set the background position via javascript as being center HEIGHT/2px, this way it should work.
document.getElementById("vision_icerik_kamp").style.height = '100px';
document.getElementById("vision_icerik_kamp").style.backgroundImage = "./image/url.gif";
document.getElementById("vision_icerik_kamp").style.backgroundPosition = "center 20px";
I do not know if x coordinate is first or the y coordinat anyway this would be an idea, than I think the div should not be absolutely empty, you should place an inside it