开发者

JQuery - slides - why outerWidth() returns 0?

problem solved, look at the end of the question

I'm writing a simple slide with a list view. It looks like that:

<div id="slides" class="slides">
        <div class="slides_container">
            <asp:ListView runat="server" ID="questionnaireList" >
                <LayoutTemplate>
                    <div id="itemPlaceholder" runat="server" >
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <div class="questionContent">
                        <h1>
                            <%# Eval("Content") %>
                        </h1>

                        <div class="qDiv">
                        </div>
                        <div class="qDiv">
                        </div>
                        <div class="qDiv">
                        </div>
                    </div>
                </ItemTemplate>
            </asp:ListView>
        </div>
    </div>

The problem is that the slide plugin wrap slides in control container to make sure slides are block level like that:

 $('.' + option.container, $(this)).children().wrapAll('<div class="slides_control"/>');

        var elem = $(this),
            control = $('.slides_control', elem),
            total = control.children().size(),
            width = control.children().outerWidth(),
            height = control.children().outerHeight(),
      开发者_如何学C      start = option.start - 1,
            effect = option.effect.indexOf(',') < 0 ? option.effect : option.effect.replace(' ', '').split(',')[0],
            paginationEffect = option.effect.indexOf(',') < 0 ? effect : option.effect.replace(' ', '').split(',')[1],
            next = 0, prev = 0, number = 0, current = 0, loaded = true, active, clicked, position, direction, imageParent, pauseTimeout, playInterval;

But the width for this "slides_control" is always 0 because the outerWidth() returns this result.. the question is: why?! I've seen that when parent is hidden it returns 0 but mine isn't..

EDIT: ok.. found the problem... there was a parent with disply:none someone else worked on my project.. sorry for this one.. Thank!


This worked for me

var divw = $("#tab1-thumbsdiv").width(true);
$("#tab1-topbar1").outerWidth(divw);

divw gets an object for tab1-thumbsdiv on assignment outerWidth then presumably is a method of that object

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜