?
Solved

Jquery Function Scroll To

Posted on 2014-02-26
1
Medium Priority
?
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 2000 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

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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.
Suggested Courses

800 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