<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Updates</title>
	<atom:link href="http://sorgalla.com/2006/12/13/updates/feed/" rel="self" type="application/rss+xml" />
	<link>http://sorgalla.com/2006/12/13/updates/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 21:39:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Jan</title>
		<link>http://sorgalla.com/2006/12/13/updates/#comment-368</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Tue, 02 Jan 2007 12:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://sorgalla.com/2006/12/13/updates/#comment-368</guid>
		<description>No, thats not a bug. jCarousel just requests the items needed for the next scroll. If you add more items than requested you need to implement your own routines for checking if a new ajax request is required. &lt;code&gt;available&lt;/code&gt; is true when the range is requested before and &lt;strong&gt;not&lt;/strong&gt; when the items exist actually.</description>
		<content:encoded><![CDATA[<p>No, thats not a bug. jCarousel just requests the items needed for the next scroll. If you add more items than requested you need to implement your own routines for checking if a new ajax request is required. <code>available</code> is true when the range is requested before and <strong>not</strong> when the items exist actually.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Kline</title>
		<link>http://sorgalla.com/2006/12/13/updates/#comment-362</link>
		<dc:creator>Josh Kline</dc:creator>
		<pubDate>Mon, 01 Jan 2007 20:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://sorgalla.com/2006/12/13/updates/#comment-362</guid>
		<description>Great plugin!
I think I found a bug in the priv.available function, or I just don't understand how it is supposed to work.


I have an itemVisible:1, itemScroll:1 carousel. 
(Eventually I'll turn on autoScroll:3 and autoScrollStopOnInteract: true, but that doesn't effect my question)
I am loading my images dynamically via ajax.

My goal is to cache images so there is not an ajax call every time next is clicked. Therefor I want to add 4 images to the items array every time loadItemHandler is called with available false.

Here is my code based on your example(I don't know what wordpress will do to the formatting)

&lt;code&gt;
function loadItemHandler(carousel, start, last, available)
{
    console.log(&#34;loadItemHandler: &#34; +
                carousel + &#34;, &#34; + start + &#34;, &#34; + last + &#34;, &#34; + available);

    if (available) {
        // Trigger loaded
        carousel.loaded();
        return;
    }

    var cr = carousel;
    var item_source = &#34;/carousel-passthrough.asp?num=&#34; + (4) +
        &#34;&#38;start=&#34; + start;
// notice that i've asked for 4 items from my server side script
    console.log(&#34;source url: &#34; + item_source);

    jQuery.get(item_source, function(data) {
        appendItemCallback(cr, start, last, data);
    });
};

function appendItemCallback(carousel, start, last, data)
{
    console.log(&#34;appendItemCallback: &#34; +
                carousel + &#34;, &#34; + start + &#34;, &#34; + last + &#34;, &#34; + data);
    var i = start;
    $(&#34;/items/item&#34;, data).each(function() {
// loop through all the items returned
        console.log(i + &#34;: &#34; + $(this).text());
        var item = carousel.add(i, getItemHTML(this));
// ..and add them to the carousel
        i++;
    });
    // Trigger loaded
    carousel.loaded();
};

function getItemHTML(data)
{
    var alias = $('alias', data).text();
    var ptr = $('ptr', data).text();
    var title = $('title', data).text();

    var url_image = &#34;http://rama.libraries.claremont.edu/cgi-bin/thumbnail.exe?CISOROOT=&#34; + alias +
    &#34;&#38;amp;CISOPTR=&#34; + ptr;
    var url_item = &#34;http://rama.libraries.claremont.edu/u?&#34; + alias + &#34;,&#34; + ptr;

    return '&#60;div&#62;' +
        '&#60;a href=&#34;' + url_item + '&#34; title=&#34;' + title + '&#34;&#62;' +
        '&#60;img src=&#34;' + url_image + '&#34; alt=&#34;' + title + '&#34; /&#62;&#60;/a&#62;&#60;/div&#62;';
};

&lt;/code&gt;

Even with that code it was making an ajax call ever click because available was always set to false.

&lt;code&gt;
            available: function(first, last) {
                if (last == undefined)
                    last = first;

                if (priv.size &#62;= last) //jk: changed from priv.end
                    return true;

                priv.end = last;

                return false;
            },
&lt;/code&gt;

When I changed the available function to look at priv.size instead of priv.end it worked.
I don't understand what priv.end is suppsed to do, or why it is only
changed in the available function.

thank you.</description>
		<content:encoded><![CDATA[<p>Great plugin!<br />
I think I found a bug in the priv.available function, or I just don&#8217;t understand how it is supposed to work.</p>
<p>I have an itemVisible:1, itemScroll:1 carousel.<br />
(Eventually I&#8217;ll turn on autoScroll:3 and autoScrollStopOnInteract: true, but that doesn&#8217;t effect my question)<br />
I am loading my images dynamically via ajax.</p>
<p>My goal is to cache images so there is not an ajax call every time next is clicked. Therefor I want to add 4 images to the items array every time loadItemHandler is called with available false.</p>
<p>Here is my code based on your example(I don&#8217;t know what wordpress will do to the formatting)</p>
<p><code><br />
function loadItemHandler(carousel, start, last, available)<br />
{<br />
    console.log(&quot;loadItemHandler: &quot; +<br />
                carousel + &quot;, &quot; + start + &quot;, &quot; + last + &quot;, &quot; + available);</p>
<p>    if (available) {<br />
        // Trigger loaded<br />
        carousel.loaded();<br />
        return;<br />
    }</p>
<p>    var cr = carousel;<br />
    var item_source = &quot;/carousel-passthrough.asp?num=&quot; + (4) +<br />
        &quot;&amp;start=&quot; + start;<br />
// notice that i've asked for 4 items from my server side script<br />
    console.log(&quot;source url: &quot; + item_source);</p>
<p>    jQuery.get(item_source, function(data) {<br />
        appendItemCallback(cr, start, last, data);<br />
    });<br />
};</p>
<p>function appendItemCallback(carousel, start, last, data)<br />
{<br />
    console.log(&quot;appendItemCallback: &quot; +<br />
                carousel + &quot;, &quot; + start + &quot;, &quot; + last + &quot;, &quot; + data);<br />
    var i = start;<br />
    $(&quot;/items/item&quot;, data).each(function() {<br />
// loop through all the items returned<br />
        console.log(i + &quot;: &quot; + $(this).text());<br />
        var item = carousel.add(i, getItemHTML(this));<br />
// ..and add them to the carousel<br />
        i++;<br />
    });<br />
    // Trigger loaded<br />
    carousel.loaded();<br />
};</p>
<p>function getItemHTML(data)<br />
{<br />
    var alias = $('alias', data).text();<br />
    var ptr = $('ptr', data).text();<br />
    var title = $('title', data).text();</p>
<p>    var url_image = &quot;http://rama.libraries.claremont.edu/cgi-bin/thumbnail.exe?CISOROOT=&quot; + alias +<br />
    &quot;&amp;amp;CISOPTR=&quot; + ptr;<br />
    var url_item = &quot;http://rama.libraries.claremont.edu/u?&quot; + alias + &quot;,&quot; + ptr;</p>
<p>    return '&lt;div&gt;' +<br />
        '&lt;a href=&quot;' + url_item + '&quot; title=&quot;' + title + '&quot;&gt;' +<br />
        '&lt;img src=&quot;' + url_image + '&quot; alt=&quot;' + title + '&quot; /&gt;&lt;/a&gt;&lt;/div&gt;';<br />
};</p>
<p></code></p>
<p>Even with that code it was making an ajax call ever click because available was always set to false.</p>
<p><code><br />
            available: function(first, last) {<br />
                if (last == undefined)<br />
                    last = first;</p>
<p>                if (priv.size &gt;= last) //jk: changed from priv.end<br />
                    return true;</p>
<p>                priv.end = last;</p>
<p>                return false;<br />
            },<br />
</code></p>
<p>When I changed the available function to look at priv.size instead of priv.end it worked.<br />
I don&#8217;t understand what priv.end is suppsed to do, or why it is only<br />
changed in the available function.</p>
<p>thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
