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

  • Home
  • SEARCH
  • 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 8432931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:15:11+00:00 2026-06-10T06:15:11+00:00

var k=0;var n=0; function shiftrigh(){ n=n+1; if(n<=193) window.setTimeout(shiftright(),100); else n=0;} function shiftright(){ k-=1; document.getElementById(abcmngcontainer).style.left=k+px;

  • 0
 var k=0;var n=0;
  function shiftrigh(){
  n=n+1;
  if(n<=193)
   window.setTimeout(shiftright(),100);
  else
      n=0;}

function shiftright(){
   k-=1;
   document.getElementById("abcmngcontainer").style.left=k+"px";
   window.setTimeout(shiftrigh(),100);
}

function shiftlef(){
  n=n+1;
  if(n<=193)
   window.setTimeout(shiftleft(),100);
  else
      n=0;}

function shiftleft(){
   k+=1;
   document.getElementById("abcmngcontainer").style.left=k+"px";
   window.setTimeout(shiftlef(),100);
}

Hi, I have the above code. The function shiftrigh when called invokes shiftright and then a cycle
is created then goes on until n is 193. Same is the case for the shiflef pair.
The code is working but it is working pretty quick. Whether I decrease the time value in settimeout or increase it, it remains the same. The updates are pretty quick, not smooth enough to see.

  • 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-10T06:15:13+00:00Added an answer on June 10, 2026 at 6:15 am

    Change:

    window.setTimeout(shiftright(),100);
    

    to:

    window.setTimeout(shiftright,100);
    

    Note the missing parens. The same with shiftleft() -> shiftleft.

    This is a common misunderstanding in JavaScript. setTimeout() requires a reference to a function (shiftright). What you are doing is calling that function immediately and passing whatever was returned from it to setTimeout(). Clearly not what was intended.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

$(function() { var number = document.getElementById(breuken); var i=0; for (i=1;i<=10;i++){ var fRandom = Math.floor(Math.random()*10);
$(document).ready(function(){ var page = window.location.hash; if(page != ){ $('a[href='+ page +']').addclass('selected'); pageload(page.replace('#/page/', 'pages/?load=')); }
var randNum = function(){ var max = document.getElementById('max').value; var min = document.getElementById('min').value; var reps
For example: (function() { var proxied = window.eval; window.eval = function() { return proxied.apply(this,
$(cell).click(function(){ var cellColor = $(this).css(background-color); if(cellColor != red){ $(this).css(background-color, red); }else{ $(this).css(background-color, blue); }
window.onload = function(){ var outerFn = function ( oParam ){ return oParam; } var
window.onload = function(){ var obj = '{ name : Raj, age : 32, married
$(document).ready(function() { var $clickable_pieces = $('.chess_piece').parent(); $($clickable_pieces).addClass('selectee'); // add selectee class var $selectee =
jQuery(document).ready(function(){ var panelContainer = jQuery('div#panels'); jQuery('<div id=tabs></div>').insertBefore(panelContainer); panelContainer.find('div.panel').each(function(n){ jQuery('div#tabs').append('<a class=tab href=#' + (n+1) +
var U = function(){ this.div = document.createElement('DIV'); this.div.id= 'oooofffff'; this.div.innerHTML = '<form action=><input type=file

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.