Remove CSS “top” and “left” attributes with jQuery

后端 未结 13 1276
故里飘歌
故里飘歌 2020-12-02 07:07

Im building a draggable map that when the map is dragged the element is given a \'left\' and \'top\' attribute with values for each as so...

13条回答
  •  臣服心动
    2020-12-02 08:06

    If you want to specifically remove top and left attributes and leave others, you can do this:

    $('.map').css('top', '').css('left', '');
    

    Or, a shorter equivalent:

    $('.map').css({
        'top': '',
        'left': ''
    });
    

提交回复
热议问题