Current location: Hot Scripts Forums » General Web Coding » JavaScript » Accordion Sliding to Screen Top on Open


Accordion Sliding to Screen Top on Open

Reply
  #1 (permalink)  
Old 12-15-08, 05:13 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
Accordion Sliding to Screen Top on Open

http://cesarvillaca.com/temp/accordion_top_scroll/

I'm using the MooTools v1.2 Accordion script. I have an issue with my accordion data not scrolling properly. If you go to the link posted above you will see that if you scroll down, then hit the Toggle 2 button that the beginning of Toggle 2 data shoots up higher than the screen top forcing you to scroll up again to read the beginning. What I want is for the accordion to open and move to the top of the visible screen.

I did find a little info on whats happening here, http://groups.google.com/group/mooto...759d09d0?hl=en but there is no solution present.

I know it can be done as it is kinda on the following pages, but I cant seem to see how they did it.
http://blog.medianotions.de/assets/d...accordion_1.2/
http://cim.saddleback.edu/~jmolina10/#
http://kumalabs.com/ingesi/

Any help is much appreciated. Thank you.
Reply With Quote
  #2 (permalink)  
Old 12-15-08, 05:36 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
The second sample page simply uses a href="#" to let the page scroll to the top. Maybe that helps you too? For you it would mean that you replace for toggler 2:

Code:
<div class="reg_toggler" style=""><b>Toggler 2</b></div>
to
Code:
<div class="reg_toggler" style=""><a href="#"><b>Toggler 2</b></a></div>
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #3 (permalink)  
Old 12-15-08, 05:53 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
ummm duh... thanks. please excuse my self while i feel so stupid. what a simple solution i missed.
Reply With Quote
  #4 (permalink)  
Old 12-15-08, 05:57 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts


Simple solutions are often the best!
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #5 (permalink)  
Old 12-15-08, 06:40 AM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
i would still like to hear more ideas on solutions. The presented solution does work, but i would like to see a solution also that is more related to the JS MooTools code.
Reply With Quote
  #6 (permalink)  
Old 12-15-08, 01:57 PM
cesarcesar cesarcesar is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 77
Thanks: 0
Thanked 1 Time in 1 Post
Thanks to Fang @ webdeveloper.com forums.

Solution - Add the following line to the following function.

Code:
el.scrollIntoView(true);
Code:
 
onComplete:function(el){
     if(el.getSize().y>0){
          el.setStyle('height','auto');
     }
     el.scrollIntoView(true);
}
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MooTools Accordion Sliding Incorrectly cesarcesar JavaScript 1 11-04-08 04:08 AM
JS script not working properly on IE but working on Firefox!!! sujata_ghosh JavaScript 4 05-21-07 05:46 AM


All times are GMT -5. The time now is 11:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.