0

这行不通。我不明白为什么这行不通。$tops 变成组合然后该值用于给 css 最高值

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);



  });
4

1 回答 1

1

jQuery offset()返回一个包含坐标的对象。所以你想做:

var combin = $tops.top + 50;
于 2013-04-14T19:24:18.307 回答