Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    JavaScript


Advertisements:










Stop From Jumping To Top Of Page?


Is there anyway to stop the page 'jumping to the top' when using a link like the below?

<a href="#"

.. I just want it to stay in the same position on the page & not jump to the top of the page every time a link like that is clicked.


View 18 Replies (Posted: 09-11-2007, 02:24 AM)

Sponsored Links:

Related Forum Messages For JavaScript category:
JQuery :: Stop Page From Jumping To The Top?
i've made a menu for my website and i've used to jQuery to create a sub menu on the 'about' section.

the problem is when you click the button, the page jumps to the top.. which i don't want it to do. is there a way round this?

here's the javascript i'm using:

$(document).ready(function () {
$('li.aboutb').click(function () {
$('ul#aboutsub').slideToggle('medium');
});
});

here's a link to the page in question: click me

Posted: 29-Mar-2011

View 3 Replies!   View Related
JQuery :: Stop Page From Jumping To The Top OnClick?
My question is, what do I need to do to stop a browser from jumping to the top of the page when a user clicks on a link which has a jquery function attached to it?So for exampleUser clicks on a link called "Older Stories"Once they do that, jquery will load in some content AJAX styleHowever, browser has jumped to the top of the page and we have to scroll back down again to see the content which has just been loaded in.I've tried putting a return statement in my code but it didn't do anythingHere's my code

var content = $("#ajax_content");
$("#olderstories").click(function(){
showLoading();

[code]....

Posted: 26-Oct-2009

View 2 Replies!   View Related
Ajax :: Stop Onclick 'page Jumping'?
Can't seem to prevent the jump to top of page behavior. I've tried everything suggested here [URL]...What else could be done to stop onclick page jumps? Here's a snippet of the HTML and JS

HTML:
<a href="javascript: return null;" onclick='javascript:getPosts("page=1&display=all"); return false;'>Everyone</a>
JS:
function getPosts(qry) {

[Code]...

Posted: Dec 17 09 at 19:31

View 9 Replies!   View Related
Stop Browser From Jumping To #name When Page Loads?
I have a form in a jQuery dialog box named "login". In JavaScript, I detect if "#login" is in the URL -- if so, it displays the login dialog box. In FF/Safari/Chrome it works fine, but in IE6/7 the browser page jumps down to the top of the form when the dialog box is displayed. I would like to prevent this from happening.I found what looked like an answer to my question here, which gives this example code: $('a.anchor').remove ().prependTo('body');

I changed "a.anchor" to "form.anchor", but it doesn't work correctly. When I first load mydomain/#login IE still jumps down to the top of the form. Then if I refresh the page it again displays the dialog box but doesn't jump down.Any idea how to globally just prevent IE from jumping to any form/anchor names?

Posted: Apr 21 09 at 18:36

View 3 Replies!   View Related
JQuery :: Stop Browser Window Jumping To Top Of Page?
I'm completely new to jquery and javascript and am just trying to get a simple script up and running. I've put this in the head of the document:

[Code]...

with a div with an id of "togglecontent" and a link with an id of "fadein" in the body about halfway down the page. The toggle works well, but when you click on the link, as well as "togglecontent" becoming visible, the browser window jumps to the top of the page, which obscures some of the toggled div. Is there any way I can stop this from happening?

Posted: 04-Jul-2009

View 3 Replies!   View Related
Html - Stop # Links That Call Functions From Jumping To Top Of Page?
How do you I stop my links like this:

<a href="#" onClick="submitComment()">

From jumping to the top of the page after the click?

Posted: Jul 19 09 at 16:17

View 3 Replies!   View Related
Page "jumping" Back To Top... How Do I Stop It?
I have a piece of javascript running about mid-section on a webpage. It's doing exactly what I want it to do, but when it runs it also "jumps" the page back to the top. That is, if I have my scroll bar half way down the page, when I click on the link and run this code it jumps me back to the top as if I'm visiting for the first time.

Any ideas on how to keep it on the same spot on the page while still executing the code?

Here is my code:

Code:
function changeOrderDetail(changeTo) {
if (changeTo == "guys") {
document.getElementById('orderDetail').style.backgroundImage = "url(images/subpage_odguysbg.jpg)";
} else {
document.getElementById('orderDetail').style.backgroundImage = "url(images/subpage_odgalsbg.jpg)";
}
}

Posted: Jan 26, 2006, 11:51

View 8 Replies!   View Related
Stop Cursor From Jumping To Beginning/end Of Textbox On Up/down Key?
How can I prevent the cursor from jumping to the beginning or end of a textbox when up or down arrow key is pressed, using JavaScript and jQuery?

Posted: Sep 17 11 at 19:49

View 1 Replies!   View Related
Stop Browser Window From Jumping On A #ID Hash Link ?
Got a client who is strictly no javascript, but in this particular circumstance, I don't think I can avoid it.

I've got a "next / previous" featured area situation going on using CSS (overflow: hidden and position: absolute) - where the click next or previous (a href="#section...") then brings the relevant div ID into view -but, the browser jumps to the top of the screen which is really very annoying.

What's the simplest possible way to prevent this jumping from happening (with javascript) - yet still be usable for users with javascript turned off?

Posted: Sep 29 10 at 12:26

View 1 Replies!   View Related
Stop Cursor From Jumping To End Of Input Field In Replace
I'm using a regular expression to strip invalid characters out of an text input area in javascript (running in IE). I run the replace function on every keyup event. However, this makes the cursor jump to the end of the text box after each keypress, which makes inline editing impossible.

Here is it in action: [url]

Does anyone know how to make it so the cursor does not jump to the end of the input box?

Posted: Nov 21 11 at 22:49

View 1 Replies!   View Related
JQuery :: How To Prevent Page Jumping
have simple slideshow here:n i v o sport.com/i n l i f e/category/2 (please remove white spaces)on the right you will see "More in Travel:" and then arrowsscroll page a bit down and click arrow you will see that page scrolling jumps up. how to keep window positio

Posted: 08-Nov-2010

View 8 Replies!   View Related
Image Link Jumping To Top Of Page ?
I am using a javascript gallery plugin, Galleriffic, to display an image gallery. I am having an issue with it as when the image is clicked it keeps jumping back to the top of the page. The problem with this is that the thumbnails which are underneath the main image on the page aren't visible and the user must then scroll to see them.

Is there any way that I can change this so that the link on the image doesn't make the page jump back to the top? I don't have my version online but the website will show you the code that is being used.

Posted: Jul 22, 2009

View 8 Replies!   View Related
Prevent Page From Jumping To The Top Onclick JS?
I have this inline JS call to a function inside an anchor tag and when click it fires the JS function however I don't want the page to jump to the top when I click it.

<a href="#" title="link" onclick="javascript:runMe()">Click Here</a>

And I have this inside the function:

function runMe() {
// do something
return false;
}

I thought the return false would be the correct way to prevent it to jump to the top but it doesn't work?

Posted: Aug 27 at 2:17

View 1 Replies!   View Related
Iphone - Webkit Causes Page Jumping
Using this code

[Code]...

Whenever t() is called, the page jumps to the top of the screen. The {} are server parsed variables, but they should be causing any problem. By jumping, I mean that the page, scrolled to the bottom, suddenly jumps to the top of the page

Posted: Mar 9 11 at 17:49

View 1 Replies!   View Related
Get Code To Execute Inline Instead Of Jumping To Top Of Page?
so im working on a piece of jquery/JS which executes (drops down a new div) when you click a link. I have the links setup as

<a href="#" id="d0">Execute 1</a>
<a href="#" id="d1">Execute 2</a>
<a href="#" id="d2">Execute 3</a>

And the jscript detects when d0, d1 or d2 is clicked and executes my script. It all works perfectly, however when you click on a link it will jump to the top of the page as a side effect of the a href="#" I assume?

Posted: 03-13-2011, 03:58 PM

View 1 Replies!   View Related
Toggle Text Keeps Jumping Back To Top Of Page?
I've tried many scripts and workarounds, but can't get this simple thing to work. As the title has it, how can I make my text NOT jump to the top of the page. here is the code.

<script type="text/javascript">
function toggleVisibility() {
document.getElementById("toggleMe").style.display = "";
if(document.getElementById("toggleMe").style.visibility == "hidden" ) {

[Code]....

Posted: Feb 15 11 at 13:19

View 2 Replies!   View Related
JQuery :: How To Prevent Click On Link From Jumping To Top Of Page
I'm currently using <A> tags with jquery to initiate things like click events, etc.
Example is <a href="#" class="someclass">Text</a>
But I hate how the '#' makes the page jump to the top of the page...what can I do instead?

Posted: Jul 15 10 at 5:36

View 9 Replies!   View Related
JQuery :: Page Jumping To The Top Of The Page?
I am using this Jquery and it works great The problem is when i click on the button the page jumps all the way to the top. I am using Miva if that makes a difference

$(document).ready(function(){
$('.drop').click(function(){
var $next = $(this).parent().next('li.drop_down');
if($next.is(':visible')) {

[Code]....

Posted: Jul 12 10 at 17:55

View 1 Replies!   View Related
JQuery :: Css - Hiding Elements On Ready Is Always Jumping On Page Load?
This is the code.I can't apply display:none;

$(document).ready(function() {
$("#LeftNav li.navCatHead").not(":first").siblings("li").hide().end().end().first().addClass("open");
});

Posted: Apr 29 10 at 15:37

View 5 Replies!   View Related
Jquery :: Page Is Jumping After $('selector').html('some Content') In Google Chrome
When I change content of some element in the bottom of page, page is scrolled to the beginning of this element. For example: $container.html($container.html()); This works good, without any page scrolling, in FF. Did someone resolve such problem before? UDP: I tried this from first answer:

$container.css('height',$container.height()+'px');
$container.html($container.html());
$container.css('height','auto');

But 3 row causes page jumping, so if just set container height - it works good. But I height of contend can be different, it is loaded from server. Now I have idea find height after inserting content and set it instead of 'auto': But Chrome return height(innerHeight, outerHeight) of parent container:

[Code]...

Posted: Jun 8 at 15:13

View 3 Replies!   View Related
JQuery :: Obvious Jumping Of Element From Original Position To New Positon After Loading Of New Page?
If you go on my test site: [URL]... You will see a navigation menu at the top, with an animated ball. Every time you click on one of the links in the navigation menu, you will notice that after a new page is loaded there is a sudden jump from the balls original position to it's new position. (Not that obvious in Firefox but very obvious in IE and Safari) My question is how can I resolve this.

I assumed that wrapping the code in the $(document).ready function would elimate this issue as everything inside it will load before the page contents are loaded.

[Code]...

Posted: 16-Jun-2010

View 2 Replies!   View Related
Gallery OnmouseUp With "#" Link Without Jumping To Top Of Page
I realize that this is probably an "old school" way of doing this, but I finally got my gallery to work with one exception. If the gallery is located lower on the page, the "#" link on the thumbnails causes the page to jump the top. Is there a better way to create this gallery?

[url]

Posted: Jun 29 at 16:56

View 3 Replies!   View Related
Asp.net - Keep The Scroll Position On The Same Position On Any Click (Page Should Not Showing Like Its Jumping Up And Down)
I have a master page, in that i am calling a aspx page suppose A.aspx, in this a.aspx page i am calling a webuser control aa.ascx, in this aa.ascx page i have a datalist in that i am binding the image. every thing is working fine. The problem is, when i am moving my page to bottom and then i am selecting one image then page is scrolling to top and then coming to bottom, where the scroll bar were there previously. What I want is scroll bar should not move on any click, I used Update panel on my ascx page, i tried to keep update panel on aspx page then also scroll bar is moving on every click. I tried to keep a js

<script language="javascript" type="text/javascript">
var xPos, yPos;
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_beginRequest(BeginRequestHandler);
prm.add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
[Code]....

Posted: Nov 8 11 at 7:45

View 1 Replies!   View Related
Jquery :: Change Page Content Without Following Content Jumping Around?
I want a page which allows a user to specify something in 5 steps (with the option to cancel a step).And I want to display this process horizontally.Each step will have a choice of the next (combobox, listbox or radiogroup (which?)) which, when selected will display some text & maybe a graphic concerning the choice and offering the next choice. [spoiler: bad ascii art follows]Initially:

<choice>



Posted: Oct 26 11 at 0:33

View 2 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved