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

后端 未结 13 1251
故里飘歌
故里飘歌 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 07:58

    You can remove all of the contents in the style attribute by doing:

    $('.map').removeAttr('style');
    

    And you can remove specific styles by doing:

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

提交回复
热议问题