Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7857861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:10:40+00:00 2026-06-02T21:10:40+00:00

function run_battle() { if(battlenow.length>0) { var div = document.getElementById(‘show_battle’); $(#show_battle).animate({ scrollTop: $(#show_battle).prop(scrollHeight) – $(‘#show_battle’).height()

  • 0
function run_battle() {

if(battlenow.length>0) { 
var div = document.getElementById('show_battle');
    $("#show_battle").animate({ scrollTop: $("#show_battle").prop("scrollHeight") -       $('#show_battle').height() }, 100);
var attempt = battlenow.shift(); 
div.innerHTML += attempt;
    $("#show_battle").animate({ scrollTop: $("#show_battle").prop("scrollHeight") - $('#show_battle').height() }, 100);
setTimeout("run_battle()",800);
  }
}

This is what I have so far. It works great in firefox. Yet in Chrome, it doesn’t work at all. I’m using Jquery 1.7.1, So that’s why I’m using .prop instead of .attr.

The battlenow array is like this.

battlenow.push('Alan hit Joe<br><br>');
battlenow.push('Joe fainted<br><br>Battle Over');

If that helps any.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:10:44+00:00Added an answer on June 2, 2026 at 9:10 pm

    Here’s the code that I use that works in all browsers to scroll to a particular element. This code scrolls the minimal amount to get the element on screen, you might want something different. Note the check for webkit browsers:

    (function($) {
    
      $.fn.scrollMinimal = function() {
    
        var cTop = this.offset().top;
        var cHeight = this.outerHeight(true);
        var windowTop = $(window).scrollTop();
        var visibleHeight = $(window).height();
    
        if (cTop < windowTop) {
          $(jQuery.browser.webkit ? "body": "html")
            .animate({'scrollTop': cTop}, 'slow', 'swing');
        } else if (cTop + cHeight > windowTop + visibleHeight) {
          $(jQuery.browser.webkit ? "body": "html")
            .animate({'scrollTop': cTop - visibleHeight + cHeight}, 'slow', 'swing');
        }
      };
    
    }(jQuery));
    

    Called like:

    $('#actions').scrollMinimal();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my HTML: <!DOCTYPE html> <html> <head> <script> function run(){ var div =
First , let's see the code. var a=0; b=1; document.write(a); function run(){ document.write(b); var
I have a jquery mouseover event which succesfully calls a javascript function $(document).ready(function() {
Examine this code var _class=function() { this.Test=100; this.Callback=function(msg) { alert(msg+\r\n+this.Test); } } function run(call)
I have the following code: var counter = 0; setInterval(run, 10); function run() {
This function is not working, the popup (div #pop_member) doesn't show. I'm using jQuery
How can I stop executing function till another function is done? $('#div').load( 'sub.html', function()
How can I make a function run after a certain element has finished animating?
abstract class base { abstract public function test(); public function run() { self::test(); }
How to run function 5 seconds after pygtk widget is shown?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.