Page "jumping" Back To Top... How Do I Stop It?
Jan 26, 2006
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)";
}
}
View 8 Replies
ADVERTISEMENT
Sep 11, 2007
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
View Related
Mar 29, 2011
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
View 3 Replies
View Related
Oct 26, 2009
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]....
View 2 Replies
View Related
Jul 4, 2009
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?
View 3 Replies
View Related
Nov 23, 2009
I have a validation function and the this is the last thing it does.
[code = var mytext=document.getElementById("sizip")
if(check5(mytext,"Zip Code must be 5 digits.")==false)
{mytext.focus();return false;}
function check5(mytext,alerttxt){
[Code]....
It will validate ok, if I do not have 5 digits, I get an error box.
But then if I click the accept button again, it puts focus back on my zip code with no error.
View 1 Replies
View Related
Feb 22, 2009
Let me start out by saying that this is for a small-time page with absolutely zero valuable information. PHP or server-side is way beyond the scope of my goals for the project.
Basically, I have a form on a page which I want to use to submit a password. However, I have realized that using the form submit always makes the browser return to the page with the form.
Well, that's not good when I want to redirect using javascript!
My javascript is:
Code:
My form HTML is:
Code:
How can I get this to stop going back to the page with the form after I submit it?
View 3 Replies
View Related
Nov 8, 2010
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
View 8 Replies
View Related
Jul 22, 2009
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.
View 8 Replies
View Related
Nov 14, 2007
Basically, I have a page that I load with 10 input fields. If users
have JS enabled I want to hide 5 of these fields so as to reduce
clutter. If the user needs these extra fields an "Add" button can be
used to display the hidden fields one by one.
Once the fields a filled in the user submits them for validation and
if there are any error They can "Go back" to make some changes. The
whole process works great in FF & Opera but IE lets me down because if
you use the Browser "Back" button the Javavscript gets executed even
though it should be loaded out of cache.
View 3 Replies
View Related
Mar 13, 2011
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?
View 1 Replies
View Related
Jun 14, 2011
how to stop the browsers back button from working after a user has logged out. I tried the windows.history.forward(1); function but it either is not working for me, or I am not putting it int the right place.The logout button is on the menu.php page. The button calls the logout.php file which redirects the user to the index.php page after logout.
View 3 Replies
View Related
Feb 24, 2004
I am trying to write a script that uses the IF statement to see wether or not a user clicked the back button to come to a page, and then if it's true to not let the page load and kick them back X number of pages (say 4) This is what I have so far:
<script language="JavaScript"><!--
if javascript:window.history.back == 1
{
javascript:window.history.back(4);
return false;
}
//--></script>
View 14 Replies
View Related
Jun 16, 2010
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]...
View 2 Replies
View Related
Aug 10, 2011
I'm using a JQuery function to slide a div into and out of visibility, but every time I toggle, the browser resets my view to the top of the web page..What I want to happen is when you click to reveal the div, the page scrolls down and the div content is in full view. When I click again to re-hide the div, I want the page to scroll back up smoothly instead of just reverting to the top of the whole page...The page url is: http:[url]....Here's my code:
Code:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".content").hide();[code]......
View 10 Replies
View Related
Mar 18, 2010
I am trying to get the back button or just a go back to work with an Ajax div? here's a minimal ajax enabled bldd.nl/stackoverflow/pagination/indexMinAjax.php but i want it to be ajax enable with the back button and for this i am trying BBQ
(benalman.com/code/projects/jquery-bbq/)
bldd.nl/stackoverflow/pagination/indexBBQAjax2.php
bldd.nl/stackoverflow/pagination/indexBBQAjax3.php
But i can't get back to a resulting page after filters have been selected?
View 1 Replies
View Related
Nov 6, 2009
I have this button, i would like this button on click to pop up an alert "are you sure".
If yes continue to the url that in the function, if no stay on the page.
Here is the inputter function
So my question is, how do i tie this jquery alert to the button to stop the action.
Right now it pops up but does not stop the page from going to the url.
View 1 Replies
View Related
Apr 30, 2009
I have a javascript alert which pops up when a user hasnt filled in a form ( php ) but when the alert appears the rest of the page behind it disappears and then reappears when the user presses ok, is there a way to stop this?code...
View 2 Replies
View Related
Oct 6, 2011
Is there a piece of code I could put in my website that will allow the same effect as the user disabling javascript in browser options? That would mean that it would stop any javascript from even executing? I would put it on an event.
View 9 Replies
View Related
Jan 21, 2009
<input class='absmiddle' type='checkbox' name='chg' id='chg' onclick='toggle(this); return false;'>
I thought the return false would prevent this but the page scrolls up a bit. What's wrong?
View 2 Replies
View Related
Oct 3, 2007
I have a very simple function. But when it is executed in Firefox the page doesn't stop loading. It works fine in IE6, IE7 and Opera. Here is the code. Very simple as you can see, though it doesn't work in FF.
<html>
<head>
<script type="text/javascript">
function writeTxt() {
document.write('Text');
}
</script>
</head>
<body onload="writeTxt()">
</body>
</html>
View 2 Replies
View Related
Feb 16, 2010
The code below taken from net works as I need it. onLoad It execute another page from a different page, the only trouble is it keeps on refreshing constantly. How can I stop this??? I'm making it into a function and calling it onLoad.
[Code]....
View 5 Replies
View Related
Jul 12, 2009
Is there any simple way to stop page refresh in a frame set? So you return to the same frame set page/pages?(Like firefox does it)
View 3 Replies
View Related
May 27, 2006
I notice when I design a basic HTML page, it
is affected if a WinXP user has Large Fonts set in their Control Panel.
However some pages, e.g. www.bbc.co.uk/news are unaffected by this I think.
They are definitely not affected by changing the font size within the
browser.
Because I want to add tables, which will word-wrap incorrectly if the font
size is changed, how can I disable allowing the browser to do this?
Basically I want the font size to stay how I designed it. If they need it
bigger, they can use the zoom option in more recent browsers. Code:
View 54 Replies
View Related
Jan 11, 2011
I have two divs that are in the same parent div, only one is shown at once. When I toggle the one that is smaller (height-wise), the position of the scroll bar (and hence the user's current location on the page) remains the same. But when I toggle back to the taller div, the scroll bar launches you back up almost to the top of the page.Is there a way I can stop this from happening? I tried return false which i knew wouldn't work. I also looked into scrollTop() but that doesn't seem like it will be of any help since it only returns values and does not set any values?
View 2 Replies
View Related
Nov 28, 2011
Here's part of the codes I got from our website. Right now, when someone wants to register on our website, they have to put into the Captcha after they finish all the other information. If the captcha is empty, there would be an alert; if it's wrong, the page would be refreshed, and there would be another alert, and at the same time, all the information would be lost and they have to fill them again. Now the question is, how can I stop the page refreshing itself? All I need is an alert and then you could retype the captcha without losing the other information.
<script type="text/javascript">
function ltrim(stringToTrim) {
return stringToTrim.replace(/^s+/,"");
}
function validateForm()
{
var okSoFar=true
[Code]...
View 4 Replies
View Related