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 8782255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:31:31+00:00 2026-06-13T20:31:31+00:00

I want to limit max height of animation when using arrows to switch. Trying

  • 0

I want to limit max height of animation when using arrows to switch. Trying to write a function, that will calculat height of div and +- step in px. But it’s now writed to variable.

var maxfloorh = $('.floor-switch').height();
var actualh = $('.floor-switch').height();
$('.floor-switch li').click(function() {
    $('#line').animate({
        top: $(this).position().top
    });
});
function floorarrs(numbr) {
    switch (numbr) {
        case 1:
            //check here maxfloorh
            $('#line').animate({
                top: '-=18'
            }, 400, function() {
                maxfloorh-'18';
                console.log(maxfloorh);
            });

        break
        case 2:
              //check here maxfloorh
            $('#line').animate({
                top: '+=18'
            }, 400, function() {
                maxfloorh+'18';
                console.log(maxfloorh);
            });

        break
    }
}
$('.arrw-up').click(function() {
    floorarrs(1);
});
$('.arrw-dwn').click(function() {
    floorarrs(2);
});​

HTML:

<div id="floors" style="margin:60px;">
    <div class="arrw-up"></div>
    <div class="floor-switch">
        <div id='line'></div>
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
        </ul>
    </div>
    <div class="arrw-dwn"></div>
</div>​

Live: http://jsfiddle.net/cxvec/2/

  • 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-13T20:31:32+00:00Added an answer on June 13, 2026 at 8:31 pm
    $('.arrw-up').click(function() {
      if ($("#line").css("top") !== "0px") {
        floorarrs(1);
      }
    });
    
    $('.arrw-dwn').click(function() {
      if ($("#line").css("top") !== ""+($("#pagination li").length-1)*18+"px") {
        floorarrs(2);
      }
    });​
    

    Here is the working fiddle

    I have changed the logic in your arrow click function, In css the initial top attribute of the element with id=line is set to 0px
    …Now whenever the top = 0px -> the div is on 1st li hence the function is not executed ans so for the down arrow…

    Note: This may note be the best solution but it’s one of the solutions

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

Sidebar

Related Questions

I want to limit the max size of a MySQL SELECT using PHP. I
i am using inputTextArea. Actually i want to limit it's max length. I am
When we want to import sql query file. we will see max file limit
I want to limit my SWF file so that it cannot be stolen and
I want to limit the results to max 10 but my code below doesn't
I want to limit a number between two values, I know that in PHP
I am using VB.net and SQL Server 2005. My Problem is that I want
I am trying to fix outofMemory in my application that has a function as
I want to limit the length of a textfield, so that a user can
i just want limit a query by parameter inside a stored, but I get

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.