Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm building a website where i'm combining two javascript's: A 'Swipe'-Js and a 'smooth scroll'-Js, now everything is working perfect together but I get a problem with the smooth scroll.

You can see the example here:
http://www.devormgevers.nl/klanten/jstest/index2.html

As you can see the delay of the 'scroll'-Js works perfectly, it also jumps to the specific anchor but the 'smooth scroll' effect doesnt show/work.

I tried all the 'smooth scroll'-Js (localscroll/scrollTo/smoothscroll/css-tricksSmoothScroll ect.) i could find on the web but none of them worked. A friend of mine made the next one where the delay now works but the smooth scroll effect still doesn't.

var jump=function(e)
{
//prevent the "normal" behaviour which would be a "hard" jump
e.preventDefault();
//Get the target
var target = $(this).attr("href");
console.log(target);
//perform animated scrolling
$('html,body').animate(
{
//get top-position of target-element and set it as scroll target
scrollTop: $(target).offset().top
//scrolldelay: 2 seconds
},2000,function()
{
//attach the hash (#jumptarget) to the pageurl
location.hash = target;
});
}

$(document).ready(function()
{
$('a[href*=#]').bind("click", jump);
return false;
});

NOTE: The smooth scroll DOES work perfect when I delete the 'height:100%;' from the ".swipe"-class in css. (example: http://www.devormgevers.nl/klanten/jstest/index2.html) but then I have a problem with the page height.

I also tried noConflict()-Js but that doesn't work either. I hope someone has an idea and can help me out.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.