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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:57:45+00:00 2026-06-08T17:57:45+00:00

How would you target the X coordinates of a div when using an if

  • 0

How would you target the X coordinates of a div when using an if statement?

What I’m trying to do is to get a div to animate across the screen but I only want it to move when certain x coordinates are met, hence why the if/else statements.

For example;

var firstXPos = -20px;
var secondXPos = -40px;
var thridXPos = -60px;

if (div's x pos?? == firstXPos){
$("#id").animate({"left" : secondXPos}, "slow");
} else (div's x pos?? == secondXPos?){
$("#id").animate({"left" : thridXPos}, "slow");
}

So how would write the code so that it can target the divs current x postion so that the if / else statements can be met?

  • 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-08T17:57:45+00:00Added an answer on June 8, 2026 at 5:57 pm

    I have used the following code to check an item’s visibility using x and y coordinates

    isVisible: function (node, doc, x, y) {
        var el = doc.elementFromPoint(x, y);
        if (node === el) return true;
        else return false;
    }
    

    so in your if statement you could use the above function to check to see if it is in that position

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

Sidebar

Related Questions

I'm developing my Android app with target set to 15, but would still like
I'm considering one selection statement that would target one of many css class names
I am developing an Android app in Eclipse. I would like to target a
When I started my universal application, I thought the one target option would be
I would like to change the target of symbolic link from within a bash
In specializing a class template, I would like to have one specialization target full-blown
I have a projectile that I would like to pass through specific coordinates at
What would be the insert SQL statement to merge data from two tables. For
I'm trying to build a rootfs for an x86 target, which is all simple
Get your newb-shields up, I'm about to sprinkle you with some. I'm trying to

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.