Displaying scroll bars on Top & Bottom of a DIV

Viewed 29665

I'm trying to display top & bottom horizontal scroll bars for a div. I found this SO question and changed page code accordingly.

HTML/Razor

<div class="wmd-view-topscroll">
    <div class="scroll-div">
    </div>
</div>
<div class="wmd-view">
    @Html.Markdown(Model.Contents)
</div>

CSS

.wmd-view-topscroll, .wmd-view
{
    overflow-x: scroll;
    overflow-y: hidden;
    width: 1000px;
}

.scroll-div
{
    width: 1000px;
}

Javascript

<script type="text/javascript">
$(function(){
    $(".wmd-view-topscroll").scroll(function(){
        $(".wmd-view")
            .scrollLeft($(".wmd-view-topscroll").scrollLeft());
    });
    $(".wmd-view").scroll(function(){
        $(".wmd-view-topscroll")
            .scrollLeft($(".wmd-view").scrollLeft());
    });
});
</script>

This displays bottom scrollbar as normal but the top scroll bar is disabled, what am I missing here?

Thanks in advance


UPDATE

Even when I remove the javascript, output is same. Seems Java Script code is not executing, but no javascript errors listed.

2 Answers
Related