Solved

Jquery Function Scroll To

Posted on 2014-02-26
1
387 Views
Last Modified: 2014-03-18
I have a JQuery function that closes a <div>
$(document).ready(function() {	
	$('input[type="button"]').click(function() {
		if ($(this).attr("value") == "custom-done") {
			$("#custom-hidden").hide('slow');
		}
	});

HTML:::
<input id="edd-purchase-button" class="edd-submit gray button" type="button" value="custom-done" name="done-customizing">

Open in new window

Currently when I click the button, it scrolls to the bottom of the page.  I want to scroll to the top of the page when I click the button.

Any suggestions?
0
Comment
Question by:rgranlund
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39890286
For a quick scroll use
          window.scrollTo(0,0)

else using jquery to animate it
           $("html,body").animate({ scrollTop: 0 }, "slow");
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now