Difference between revisions of "Team:Cambridge-JIC/TestHome"
Line 24: | Line 24: | ||
border: #555 solid; | border: #555 solid; | ||
margin-bottom: 5px; | margin-bottom: 5px; | ||
+ | cursor:pointer; | ||
} | } | ||
</style> | </style> | ||
Line 55: | Line 56: | ||
$("section").each(function(){ | $("section").each(function(){ | ||
if($(this).attr("id") != "footer-sec") { | if($(this).attr("id") != "footer-sec") { | ||
− | $("#sidebar").append("<div class=\"sidebar-item\""+(ix==0?" style=\"background: #555\"":"")+"></div>") | + | $("#sidebar").append("<div onclick=\"scrollsection(\"+ix+\")\" class=\"sidebar-item\""+(ix==0?" style=\"background: #555\"":"")+"></div>") |
} | } | ||
ix++ | ix++ | ||
Line 83: | Line 84: | ||
}); | }); | ||
+ | |||
+ | function scrollsection(id) { | ||
+ | $("html, body").animate({ scrollTop: $($("section").get(id)).offset().top }, 1000); | ||
+ | } | ||
</script> | </script> | ||
<div id="sidebar"></div> | <div id="sidebar"></div> |
Revision as of 02:14, 4 August 2015