English 中文(简体)
在将超文本内容装入DIV后再加固彩色箱
原标题:Resizing colorbox after loading HTML content into a DIV

我向这里的任何一个和所有职位投了风险,这些职位涉及彩色箱的转播问题、房地产和许多其他东西! 不管怎么说,这部非常简便的法典正在把我推向上墙,我想知道这部墙能否得到解答?

<script type="text/javascript">
$(document).ready(function () {
    $("#text").load("<%= Model.FileLocation %>");
    $.fn.colorbox.resize();
});
</script>
<div id="text"></div>

Above is the code (which, I would imagine - should work like a charm). I ve tried using a $.get and putting the resize in a callback, using timeouts and separating things with functions.

I ve also verified that nothing is broken, the text is being loaded (doing an alert with $("#text") as the message shows me the loaded text. Also I can specify widths and/or heights for the resize function and they work find, however, I can t do this based on the loaded content.

长期缩小的职位,......为什么世界上这种事情不会消失的任何想法?

最佳回答

Thanks to anyone who read and tried to come up with a reason to why this didn t work, however, I finally found a work-around.

看来,由于某种原因,即使将<代码>resize(>)放在成功的背书上,它仍然被称作太早。 我能够开火,人工进入“<>color Box.resize()”指挥线,在装货之后,尽管电击失败,但还是进行了罚款。

因此,我这样做了。

$(document).ready(function () {
        jQuery.ajaxSettings.async = false;

        $( #text ).load( <%= Model.FileLocation %> );
        $.fn.colorbox.resize();
});

在亚克斯岛设立<条码>sync,以伪造,迫使它被召回,现在它发挥了巨大作用,而且正在迅速装上。

问题回答

等待到内容实际装满为止。

<script type="text/javascript">
$(document).ready(function () {
    $("#text").load("<%= Model.FileLocation %>", function() {
         $.fn.colorbox.resize();
    });
});
</script>
<div id="text"></div>




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签