1

So I'm having a problem with my songs not scrolling into view when the selected song is not in view.

I'm using Soundcloud's API custom player, so

<div class="sc-player">
    <a href="http://soundcloud.com/user/song">Song Name</a>
</div>

turns into this on page load: http://nowthatsgenius.com/clients/ageniusalbum/ (too much to add, but there's my example).

So when a song ends and the next song begins, the LI class 'active' is removed from the prev song and appended to the new song's LI. So I need the ScrollTo script to scroll the next song into view. I'm only a UI designer, with some jQuery knowledge, but not enough to solve this problem.

The end goal is mobile. While you're listening, if you need to check which song you are on, if say for example the phone goes to sleep, you turn the phone back and check, the active song should be in view and you shouldn't have to scroll and find the active song.

I'm using this script: http://flesler.blogspot.com/2007/10/jqueryscrollto.html

$(document).ready(function() {
$(".sc-player").scrollTo($('.sc-trackslist li.active'), 800 );
});

My attempt to call the ScrollTo function, but when that happens, I get the:

"Uncaught TypeError: Cannot read property 'slice' of undefined" error

If you know of a lead to a solution, please let me know.

Thanks!

4

0 回答 0