Solved

Jquery Function Scroll To

Posted on 2014-02-26
1
390 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in script 11 45
php string masking 4 28
Facial recognition to look through the whole database for a person 3 40
is this a cms? 8 34
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

910 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