/    Sign up×
Community /Pin to ProfileBookmark

Prevent window from scrolling to the top after popup message

So I have a webpage listing a bunch of book titles. I have coded a popup message with the book summary to appear when the title is clicked on.

There is one problem. After the viewer reads a summary he or she clicks ok on the popup message, and then the window automatically scrolls back to the top.

This will be a nuisance; if the user is half way or close to the end of the list, he or she would have to keep scrolling back down to his or her spot after reading the book summary.

Is there a way to prevent this?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Jarrod1937May 10.2010 — So I have a webpage listing a bunch of book titles. I have coded a popup message with the book summary to appear when the title is clicked on.

There is one problem. After the viewer reads a summary he or she clicks ok on the popup message, and then the window automatically scrolls back to the top.

This will be a nuisance; if the user is half way or close to the end of the list, he or she would have to keep scrolling back down to his or her spot after reading the book summary.

Is there a way to prevent this?[/QUOTE]

Can we see the page in question?
Copy linkTweet thisAlerts:
@GullanianMay 10.2010 — Try adding:

return false

After the code to popup has run.
×

Success!

Help @dsrt16 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.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...