This really should not be that hard. For my site, I am using a PNG that has been mapped as my navigation bar, with 7 links on it. The nav bar is fixed around the top middle of the page. The site is a single page with 7 sections, all 2000px high. I would very much like to have my page smooth-scroll when one of the nav links is clicked, but so far I am finding this impossible to do. All jquery smooth scroll scripts involve anchors, which I am unable to put within an image-map.
<div class='navbar-cont'>
<div class ='navbar'>
<img src='NavBar.png' alt ='Navigation Bar' width="619" height="48" usemap="#NavMap"/>
<map id="NavMap" name="NavMap">
<area shape ="rect" coords ="1,0,70,48" href="#" alt="Home"/>
<area shape ="rect" coords ="76,0,150,48" href="#News" alt="News"/>
<area shape ="rect" coords ="158,0,264,48" href="#AboutUs" alt="About Us"/>
<area shape ="rect" coords ="270,0,370,48" href="#Contact" alt="Contact"/>
<area shape ="rect" coords ="375,0,450,48" href="#Music" alt="Music"/>
<area shape ="rect" coords ="455,0,550,48" href="#Photos" alt="Photos"/>
<area shape ="rect" coords ="555,0,615,48" href="#Links" alt="Links"/>
</map>
</div>
As you can see, there is no where to put an "a" tag in the map. If I put it before "area" the links no longer are clickable. I am unable to put it before "href" within the "area" tag because that just doesn't work. Without anchors, every jquery script will not work as far as I can tell.
Is there seriously no other way to have smooth scrolling without Javascript? This is an extremely simple task that seems to have an extraordinary amount of convoluted "solutions".
Please do not bother posting any smooth scroll scripts you can find, I have literally tested about 15 of them with no success.
This is currently my script section:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#homeButton").click(function() {
$('html, body').animate({
scrollTop: 0 }, 1000);
});
$("#newsButton").click(function() {
$('html, body').animate({
scrollTop: $("#News").offset().top
}, 2000);
});
$("#aboutButton").click(function() {
$('html, body').animate({
scrollTop: $("#AboutUs").offset().top
}, 2000);
});
$("#contactButton").click(function() {
$('html, body').animate({
scrollTop: $("#Contact").offset().top
}, 2000);
});
$("#musicButton").click(function() {
$('html, body').animate({
scrollTop: $("#Music").offset().top
}, 2000);
});
$("#photosButton").click(function() {
$('html, body').animate({
scrollTop: $("#Photos").offset().top
}, 2000);
});
$("#linksButton").click(function() {
$('html, body').animate({
scrollTop: $("#Links").offset().top
}, 2000);
});
});
</script>