Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-31-2009, 05:37 PM   PM User | #1
mberkom
New Coder

 
Join Date: May 2008
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
mberkom is an unknown quantity at this point
Smile Show element scrolls the page to the top: Solved

This problem solved

Okay I have another question.

In my code, using the "ajax" call I load an html div into my page, define its top and left and then make it visible using ".fadeIn()" (".show()" does the same thing). The element is positioned fixed and I want it (no matter where I am scrolled on the page) to show up the distance from the top and left that I specify. Instead it scrolls me to the top of the page before showing the element. How can I stop this scrolling and have it just show where I am scrolled on the page?

Code:
//".floating_box" refers to the div in the html
$.post(html_url, function(data){
	$('body:last-child').append(data);
	add_functionality();
});
$('.floating_box').css({'top' : '40px', 'left' : '400px'});
$('.floating_box').fadeIn('fast');

Last edited by mberkom; 03-31-2009 at 07:22 PM.. Reason: problem solved
mberkom is offline   Reply With Quote
Old 03-31-2009, 05:52 PM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
Doesn't seem to achieve that effect when tested locally. Where is the rest of your code? Perhaps something else is doing it... like a refresh or something else along those lines?
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?
Eldarrion is offline   Reply With Quote
Old 03-31-2009, 06:51 PM   PM User | #3
mberkom
New Coder

 
Join Date: May 2008
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
mberkom is an unknown quantity at this point
Alright, here is all my code. Problem occurs at line #103 in the scripts.js file. Thanks for the help.

Code removed

Last edited by mberkom; 03-31-2009 at 07:23 PM..
mberkom is offline   Reply With Quote
Old 03-31-2009, 07:14 PM   PM User | #4
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
And the jumpy effect comes from:

Code:
<a href="#" class="activate_link">Activate Box Load</a><br />
I would suggest doing the following instead:

Code:
<a href="#" onclick='return false;' class="activate_link">Activate Box Load</a><br />
Which should force the browser to NOT follow the link and thus jump all the way up to the start of the page.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?
Eldarrion is offline   Reply With Quote
Users who have thanked Eldarrion for this post:
mberkom (03-31-2009)
Old 03-31-2009, 07:21 PM   PM User | #5
mberkom
New Coder

 
Join Date: May 2008
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
mberkom is an unknown quantity at this point
That was easy! I should have thought that it was the link reloading the page. Thanks for the help.
mberkom is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:10 AM.


Advertisement
Log in to turn off these ads.