Jump to content


Photo

Need Help With A Simple Javascript Statement


  • Please log in to reply
1 reply to this topic

#1 Kervtuza

Kervtuza

    Member

  • Member
  • PipPipPip
  • 62 posts

Posted 03 January 2013 - 01:03 AM

Hey Guys,

I am looking for a little help on writing one of my first scripts.

I currently have

<script> 
$(document).ready(function(){
  $("#nav_home").click(function(){
    $("#content, #site_info").animate({
      top:'0px',
    });
  });
  $("#nav_about").click(function(){
    $("#content, #site_info").animate({
      top:'-1070px',
    });
  });
  $("#nav_projects").click(function(){
    $("#content, #site_info").animate({
      top:'-1590px',
    });
  });
  $("#nav_contact").click(function(){
    $("#content, #site_info").animate({
      top:'-2650px',
    });
  });
});
</script>

I want add to the script a conditional statement that says

if (#content left property = -1070px){
$("#branding").animate({
top:'-100px',
});
});

The problem is I don't know how to access the css property of the unique id...

Any ideas?
  • 0

#2 Ben

Ben

    Administrator

  • Administrators
  • 5,682 posts
  • LocationGainesville, Florida

Posted 03 January 2013 - 11:01 AM

I would suggest using .position(): http://api.jquery.com/position/
  • 0
Benjamin Falk
Falken Creative : Twitter




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

★★★★★ 5 Star Rated Web Developer Course - check it out now!