开发者

ajax positioning

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_);
            }开发者_JS百科  
    </script>

and this is the div:

<div id="vision_icerik_kamp"></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 &nbsp; inside it

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜