0

This doesn't work. I don't understand why this won't work. $tops turns into combined then that value is used to give css top value

var $popout = $('.popOut'),
      $currentButton,
      $win = $(window),
      $trigger = $('#leaderBottom a'),
      $closeOut = $('.xOut');





$('#leaderBottom a').on("click", function(event) {
      event.preventDefault();
        $popout.css('display','block');
        $('<div class="overlay"></div>').appendTo('#leaderBottom');

          // find the position of the link according to window
           var $tops = $(this).offset();

          // combined  that nuM plus 50
           var combin = $tops + 50;

            ///adds it all up. and it sends it to combined
           $popout.css("top",combin);

           console.log(combin);



  });
1
  • i think you have to say something like $popout.css("top","12px");, px should be in there. Commented Apr 14, 2013 at 19:25

1 Answer 1

1

jQuery offset() returns an object which contains the co-ordinates. So you would want to do:

var combin = $tops.top + 50;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.