I wonder whether someone may be able to help me please.
The code below is a section of my web page which creates a sidebar for a Google map.
// == rebuilds the sidebar to match the markers currently displayed ==
function makeSidebar() {
var html = "";
for (var i = 0; i < gmarkers.length; i++) {
if (gmarkers[i].getVisible()) {
html += '<a href="javascript:myclick(' + i + ')">' + gmarkers[i].myname + " - " + gmarkers[i].mydescription + '<\/a><br>';
}
}
document.getElementById("sidebar").innerHTML = html;
}
The problem I have is that as the list of map marker grows its becoming increasingly difficult to scroll the page to see all the entries.
What I’d like to be able to do is create a vertical scroll bar which will allow easier navigation. I’ve done some reading on this, and I think I’m correct in saying that if this was in a div I could use the overflow?. but I’m not sure how to replicate when using Javascript.
I just wondered whether someone could perhaps take a look at this please and offer some guidance on how I could go about this.
Many thanks and Kind regards
To allow a
divto be scrolled, simple add the css propertyoverflowwith the value ofscroll– you will need to provide theheightattribute tooexample here
If your
sidebarelement was adivyou could just apply the following :You would need to change the
heightandwidthvalues as you require ….A value of
scrollmeans :Docs for the overflow property here