Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery offset value not getting new height created from onload animation
    primarykey
    data
    text
    <p>I am using <code>.offset();</code> to calculate a value from top in a variable...</p> <pre><code>pos = content.offset(); </code></pre> <p>But my problem is I have a animation that runs when a twitter api loads.</p> <p>So this means there is about a 2-5 second delay on this animation before it fires. This animation increases my <code>content = $("#slider-container")</code> height (by about 64px). But sometimes if twitter never loads, then the animation will never run.</p> <p>So when this variable is being used in my script below, it gets the offset value from before the twitter animation. Even when the animation has run.</p> <p>As you can see - my second script, this is my twitter animation that runs when the tweet loads - and <code>$('#tweetbar')</code> is inside <code>$("#slider-container")</code></p> <p>How can I sort this?</p> <p><br /></p> <p>My script...</p> <pre><code>$(window).bind("resize.browsersize", function() { var $tabs = $('#left-tab, #right-tab'), positionScroll = $(window).height() / 2, content = $("#slider-container"), pos = content.offset(); $(window).scroll(function(){ if ( $(window).scrollTop() &gt;= pos.top + 265 - positionScroll ) { if ($(window).scrollTop() + positionScroll &lt;= pos.top + content.height() - $tabs.height()) { $tabs.removeAttr('style').css({ position:'fixed', top: positionScroll + 'px'}); } else { $tabs.removeAttr('style').css({ top: content.height() - $tabs.height() }); } } else { $tabs.removeAttr('style').css({ top: '265px' }); } }); }).trigger("resize.browsersize"); </code></pre> <p><br /></p> <hr /> <p><br /></p> <p>My animation script...</p> <pre><code>$("#tweetbar").tweet({ username: "twitter", join_text: "auto", count: 1, auto_join_text_default: "we said,", auto_join_text_ed: "we", auto_join_text_ing: "we were", auto_join_text_reply: "we replied to", auto_join_text_url: "we were checking out", loading_text: "loading tweets..." }).bind("loaded", function(){ $('#tweetbar').slideDown(); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload