I seem to have problems scrolling an element using the .mCustomScrollbar ("scrollTo", divID) function.
I have a div (id = "# wrapper") containing many divs (anything up to 800 divs heights each 20px).
Then I add mCustomScrollbar to this #wrapper div to use my own scroll functions this way:
$("#wrapper").mCustomScrollbar();
Now I have a large scrollable div containing a โlist-likeโ divs structure, not the actual list, but only divs stacked on top of each other, like a list.
Elsewhere on my page, I have a button containing the div element identifier inside the "#wrapper" div, when I click this button, I want to scroll the div element in the view, this is my current attempt:
var divID = 'div[id^=' + clickedID +']';
$('#wrapper').mCustomScrollbar("scrollTo",divID);
This function claims to scroll through the "divID" in the form in the #wrapper div and however the problem is that it sometimes takes 2-4 to call the "scrollTo" function before the "divID" appears.
Can someone please help me understand why the โdivIDโ is not looking at the appearance of the first call to the โscrollToโ function and how can I make it work as I expect?
Yours faithfully
source
share