Sup yall,
Thanks to @hanoo 's answer on this question http://StackOverflow.com/questions/4198041/jQuery-Smooth-Scroll-to-an-Anchor
I've got my Smooth Scrolling working, but my tooltips stopped working. Which made me think, my tooltips also stopped working when I have a modal, mmm...
My jQuery/Javascript is a little dodgy. Also, I'm sure there are prettier ways to code all this (I suppose it'll work then). Any help would be appreciated :)
<script>
$(document).ready(function () {
$("#NoneSelected").tooltip({
placement: 'bottom'
});
$("#JumpUp").tooltip({
placement: 'top'
});
$("#JumpDown").tooltip({
placement: 'bottom'
});
});
$(".scroll").click(function (event) {
event.preventDefault();
//calculate destination place
var dest = 0;
if ($(this.hash).offset().top > $(document).height() - $(window).height()) {
dest = $(document).height() - $(window).height();
} else {
dest = $(this.hash).offset().top;
}
//go to destination
$('html,body').animate({ scrollTop: dest }, 100, 'swing');
});
</script>
EDIT: Here's the HTML
<section id="uptop"></section>
<div class="jump-downunder">
<a href="#downunder" class="btn btn-default btn-sm" id="JumpDown" data-placement="bottom" rel="popover" data-toggle="tooltip" data-original-title="down under">Down</a>
</div>
<p>body content</p>
<div class="jump-uptop">
<a href="#uptop" class="btn btn-default btn-sm" id="JumpUp" data-placement="top" rel="popover" data-toggle="tooltip" data-original-title="up top">Up</a>
</div>
<section id="downunder"></section>
The DIVs class="jump-uptop" and class="jump-uptop" is purely just for styling.