Giter Site home page Giter Site logo

Z-index and position about spin.js HOT 14 CLOSED

lencioni avatar lencioni commented on June 11, 2024
Z-index and position

from spin.js.

Comments (14)

glennfu avatar glennfu commented on June 11, 2024

Can't you just use CSS for this yourself outside the javascript plugin?

from spin.js.

lencioni avatar lencioni commented on June 11, 2024

I don't believe there is a very good way to select the spinner.

from spin.js.

glennfu avatar glennfu commented on June 11, 2024

In css:

.spinner {
    color: black;
    display: inline-block;
    height: 44px;
    width: 44px;
}
.spinner.someclass {
    color: white;
}

In html:

<div class="spinner"></div>
<div class="spinner someclass"></div>

In js:

$(".spinner").spin();

This works on my spinners!

from spin.js.

lencioni avatar lencioni commented on June 11, 2024

Sure that works, but I shouldn't need to add extra markup to use the spinner.

from spin.js.

okize avatar okize commented on June 11, 2024

I added this to Spinner.defaults:
className: 'spinner',
And this:
el.setAttribute('class', self.opts.className);
Right before
el.setAttribute('aria-role', 'progressbar');

That adds a class of 'spinner' to the outermost div, which you can use to select and set z-index & positioning (will need to use !important for 'top' and 'left' to override inline style.

from spin.js.

andyburke avatar andyburke commented on June 11, 2024

Love this spinner, but I wanted to put in an upvote on this issue as well. I have some really tall elements that I'd like to be able to spin on, and instead of centering vertically, I'd like to just be able to set a vertical offset from the top of the element.

Maybe if the option 'vertical-offset' were set to something it could override the vertical centering?

from spin.js.

lencioni avatar lencioni commented on June 11, 2024

Just adding a class to the spinner automatically would be helpful, then I could target it in my CSS.

from spin.js.

glennfu avatar glennfu commented on June 11, 2024

I still don't see the issue personally. Assuming you're using a selector to find the elements you want to attach the spinner to, then you can use the same selector in CSS. If you're not using a selector and instead are manually targeting every place you want to apply the spinner in your javascript, then I personally think that's poor form and you'll find it gets really annoying later on as the project grows and you use it in more places.

On the other hand, if you don't like my idea, then I prefer ozike's method of adding a global classname to all the spinners.

from spin.js.

andyburke avatar andyburke commented on June 11, 2024

Created a pull request to address this issue: #55

from spin.js.

fgnass avatar fgnass commented on June 11, 2024

There are now new config options in 1.2.4: zIndex, className, top and left.

from spin.js.

lencioni avatar lencioni commented on June 11, 2024

Thanks Felix!

from spin.js.

andyburke avatar andyburke commented on June 11, 2024

I agree with the rename to top/left (vs. the topOffset/leftOffset from my patch), but I feel like they should just take valid CSS settings and not add the px. So, for instance, I should be able to do:

top: '50%'

from spin.js.

etuan avatar etuan commented on June 11, 2024

top: '50%' would be awesome.

from spin.js.

jbetances avatar jbetances commented on June 11, 2024

Is there a way to both have the spinner going and at the same time be able click at other elements within the page?

from spin.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.