I need Jquery's scrollTo function to work for this website: http://cinicraft.com/Silverman/index.html
I've tried the following
$(document).ready(function()
{
$("div.btnLp3").click(function(){
$('body,html').scrollTo('#target-examples', 800, {easing:'elasout'});
});
});
And I've tried this too:
$(document).ready(function()
{
$("div.btnLp3").click(function(){
$('html, body').animate({ scrollTop: $(window.location.hash).offset().top}, 1000);
});
});
I can't seem to get scrollTo
working at all. Does anyone have any ideas? Here's what I have imported:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"> </script>
Try this
$("#clickme").click(function() {
$('html, body').animate({
scrollTop: $("#wrap2").offset().top
}, 2000);
return false;
});
FIDDLE
/*
* ScrollToElement 1.0
* Copyright (c) 2009 Lauri Huovila, Neovica Oy
* [email protected]
* http://www.neovica.fi
*
* Dual licensed under the MIT and GPL licenses.
*/
(function($) {
$.scrollToElement = function($element, speed) {
speed = speed || 750;
$("html, body").animate({
scrollTop: $element.offset().top,
scrollLeft: $element.offset().left
}, speed);
return $element;
};
$.fn.scrollTo = function(speed) {
speed = speed || "normal";
return $.scrollToElement(this, speed);
};
})(jQuery);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With