ScrollTo doesn't bind, just scrolls, so no need to use LiveQuery to
call it.
Also, id's can't start with a number.

Example:

function scrollToID( id ) {
  $('#hold').scrollTo( '#'+id, 1000 );
}

$('#hold').load('someData.php', function(){
    scrollToID( 'foo' );
});

--
Ariel Flesler
http://flesler.blogspot.com/


On Sep 6, 11:57 pm, pedalpete <[EMAIL PROTECTED]> wrote:
> Thanks Ariel,
>
> I guess I should be using scrollTo rather than LocalScroll.
>
> Unfortunately I won't have a demo up for a few days.
>
> I started to wonder if part of the problem was that the scrollable
> list is returned via ajax, so I have tried using livequery, but still
> no scrolling.
>
> Here's the code I'm using now
> [code]
>         function scrollToShow(trackid){
>         $('#hold').livequery(function(){
>         $('#hold').scrollTo($('.holdList #'+trackid));
>         });
>         }
>
> [/code]
>
> the id is a numeric value, so hopefully that won't be causing
> problems.
>
> Does the code look right to you?
> the  '#hold' is a non-scrolling div, and the '.holdList' is the
> scrolling div.
> I've also tried
> [code]
> $('.holdList').scrollTo($('.#'+trackid'));
> [/code]
> but that didn't work either.
>
> Thanks for your help,
> Pete
> On Sep 6, 6:16 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote:
>
> > That function is meant to start a scrolling animation ?
>
> > LocalScroll is meant to be called to "prepare" the field, that is,
> > bound events that will eventually trigger scrolling.
> > ScrollTo is the one to call for an instant scroll.
>
> > You either call LocalScroll at start, or ScrollTo manually if you want
> > to do all that yourself.
>
> > Note that the 'target' property needs to be the scrollable element.
> > If you have a demo online, it'll be easier to pull this out.
>
> > Cheers
>
> > --
> > Ariel Fleslerhttp://flesler.blogspot.com/
>
> > On Sep 6, 7:59 pm, pedalpete <[EMAIL PROTECTED]> wrote:
>
> > > Thanks Karl, I didn't realize I shouldn't start an id with numeric
> > > characters, I've been doing it for a long time without issue.
>
> > > I've tried the changes you recommended, but still no scrolling.
>
> > > I added an 'a' to the beginning of the id, and now my code is
>
> > > [code]
> > >         function scrollToShow(trackid){
> > >                 $.localScroll({
> > >                 target: '.holdList li#a'+trackid, //could be a
> > > selector or a jQuery
> > > object too.
> > >                 queue:true,
> > >                 duration:1000,
> > >                 hash:true
> > >         });
> > >         }
> > > [/code]
>
> > > i've checked that I have the right class name for the list, and that
> > > the id's are in the html properly.
>
> > > On Sep 6, 2:03 am, "Karl Rudd" <[EMAIL PROTECTED]> wrote:
>
> > > > Use something like id="number1" rather than name="number1". (Just a
> > > > note, technically an id needs to start with a none numeric character).
> > > > Then use target: '#'number' + trackid
>
> > > > The name attribute is really only for form input elements.
>
> > > > Karl Rudd
>
> > > > On Sat, Sep 6, 2008 at 12:17 PM, pedalpete <[EMAIL PROTECTED]> wrote:
>
> > > > > I've got a div on my page with a scrollable list in it.
> > > > > When I load the page, I want the list to scroll to a specific item.
> > > > > Each item has a class and name, so I'm trying to address them with
> > > > > that.
>
> > > > > I've been toying with the flesler scroll plugins, but am not sure if
> > > > > they are what i should be using.
>
> > > > > .scrollTo kept throwing errors at me, but .localScroll doesn't error
> > > > > out, but doesn't scroll either.
>
> > > > > here's the code I'm using
> > > > > [code]
> > > > >        function scrollToShow(showid){
> > > > >                $.localScroll({
> > > > >                target: '.holdList li.'+trackid, //could be a selector 
> > > > > or a jQuery
> > > > > object too.
> > > > >                queue:true,
> > > > >                duration:1000,
> > > > >                hash:true
> > > > >        });
> > > > >        }
> > > > > [/code]
>
> > > > > the code for the list is pretty simplelike this
> > > > > [code]
> > > > > <ul class="holdList">
> > > > >        <li class="1" name="1">first in list</li>
> > > > >        <li class="2" name="2">second in list</li>
> > > > > </ul>
> > > > > [/code]
>
> > > > > Any idea on a simple way to do this? Or if the .localScroll
> > > > > or .scrollTo allow scrolling in a div?

Reply via email to