I have created some code which runs a function on the onSeek to change the highlighting of the next item.

But when I click on the prevPage button it goes to the next item too.

I have this:

  // initialize scrollable
                window.api = $("div.scrollable").scrollable({
                    clickable: false,
                    activeClass: "active",
                    onBeforeSeek: function() {
                        //remove highlighting from all images
                    $(".items img").removeClass("selected");
                        changeimage(nextItem);
                    }
                }).circular().autoscroll({
                    interval: 4000,
                    api: true,
                    autoplay: false,
                    steps: 1

                });

But I need the OnBeforeSeek (or OnSeek) to check whether it was the prevPage or nextPage that called it so that it navigates to the correct one.

Or I should just pass the focused iten to my changeimage(nextItem); function (as nextItem or focused item)

Any help?

Thanks