/    Sign up×
Community /Pin to ProfileBookmark

Jumping around smoothly within the window – javascript?

salut!
I am a complete nerd regarding javascript and even html. I am still just fiddling, but I am trying hard.
I am trying to build a website which is supposed to be quite big, means you have to do a lot horizontal and vertical scrolling. One problem is: when you click on the scrollbar or menu it will jump to the point of interest very hard. Is there a way of making the jump more soft, more smooth, maybe with a slight experience of moving???
if this is nothing for javascript, what is it for???
thanks a lot!
johntop

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jun 11.2007 — What scrollbar or menu, how are you moving the user to the location? Need some more details so we are not left in the dark trying to figure out your situation.

Eric
Copy linkTweet thisAlerts:
@johntopauthorJun 11.2007 — well, I have a floating layer, but that doesn't really matter, does it? With that menu you can either use the menu or the scroll bar. you could grab the slider within the scrollbar or just click on the scrollbar area. that is the problem: if someone doesn't like to use the slider, he could either menu or click on the scroll area. and because I put some anchors up on the website, the window will instantly jump to the anchor, without really showing the movement itself. Do you understand? It is rather complicated, maybe not the subject itself, but my description. It's because I really don't know much about stuff, you know!

Ergo: the idea was: the user clicks on the menu (which could be a javascript floating one) or somewhere on the scrollarea to fiddle around and the window should do a shift towards that point.

That would be really cool, if someone -or even you Eric- can figure that out for me, or just a hint!

thanks, regards

johntop
Copy linkTweet thisAlerts:
@A1ien51Jun 11.2007 — If it is a scrollbar that is part of the browser, you will have not control over that.

For the menu, you can look into window.moveBy(x,y), setTimeout, and

<i>
</i>function getElementPosition(theElement){
var posX = 0;
var posY = 0;
while(theElement != null){
posX += theElement.offsetLeft;
posY += theElement.offsetTop;
theElement = theElement.offsetParent;
} <br/>
return{x: posX, y: posY};
}
var pos = getElementPosition(document.getElementById("someId"));
alert(pos.x +"," + pos.y);


Eric
Copy linkTweet thisAlerts:
@johntopauthorJun 11.2007 — Hm, I shall give that one a try.

Thanks a lot from Europe
×

Success!

Help @johntop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...