Search code examples
javascriptcssangularjsspin.js

spin.js / angular-spinner: how to position spin into DOM element (plunker demo included)


I've found angular-spinner which is based on spin.js, and I want to use it. Anyway, the example found in angular-spinner's README (http://plnkr.co/edit/BGLUYcylbIVJRz6ztbhf?p=preview) doesn't work as I expect. I want the spinner to overlay the selected DOM element and not the global window.

I have modified the plunker: http://plnkr.co/edit/9xsi8OFui3VeYuZ810VZ?p=preview - here you can see that there is a <div> element with red background. The spinner is outside it - what can I do to make it centered inside the red-background div?


Solution

  • Add

    position: relative;
    

    in that red container

    http://plnkr.co/edit/oPStHrLHXKUq3HE9pET0?p=preview