File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jack Up Browser Viewport

 
Mark Reyes
Ranch Hand
Posts: 426
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Good Day!
I would like to ask advise from the gurus here regarding what I want to do.

I basically have this HTML Markup, my form below has so many inputs and what the browser does is to
create a scrollbar when I am at the bottom of the page.


My problem is in my Jquery code. On click of the proceed button and a successful json response was generated.
I switch the focus into my info-div and change some message.


My problem is, I am still at the bottom of my browser viewport. I wanted my browser viewport to be at the top so that
user would see the animation.

Is there a way to do this? The .focus() function of jquery seems to not put my viewport back to the top.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't there a moveTo or scroll function or something? Have you considered searching the web?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mark reyes wrote:Is there a way to do this? The .focus() function of jquery seems to not put my viewport back to the top.

That's right -- .focus() assigns a focus handler. So why don't you just use the element's focus method? Why over-complicate things?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64175
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set focus to first enabled input:
 
Mark Reyes
Ranch Hand
Posts: 426
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set focus to first enabled input:


Hi Bear, I tried doing this. While it does set the focus at the first enabled input and jackup the browser a little, my info-div is still hidden as there is still an image in between them.

Isn't there a moveTo or scroll function or something? Have you considered searching the web?


Hi David, I actually played around with this code. I use the scrollTop value but it doesnt jackup the page. I am not sure if this has something to do
with the div initially not displayed so that's why the scrollTop function does not work. Or I could be wrong also..


I tried searching around the net and found this solution. I am not sure if this is elegant but it does do what I wanted, tested it in IE6 and Firefox.



Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic