Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: allow class name other than "layer" #204

Closed
lupos opened this issue Jun 16, 2017 · 11 comments
Closed

enhancement: allow class name other than "layer" #204

lupos opened this issue Jun 16, 2017 · 11 comments

Comments

@lupos
Copy link

lupos commented Jun 16, 2017

So I'm using this is a much larger project and attempting to name space all css classes and layer stands out as a fairly generic name. It's unlikely to actually cause an issue but it would be great to be able to pass in an alternative layer class name or a prefix ('my-custom-layer') so the library doesn't dictate code style in anyway.

@reneroth
Copy link
Collaborator

+1 from me on this. If nobody vetoes, I'd completely remove the JS-side class name requirement. In my opinion, the script should be CSS-agnostic.

reneroth pushed a commit that referenced this issue Jun 29, 2017
@reneroth
Copy link
Collaborator

No vetoes received, have implemented this suggestion. Thank you! :)

@caiotarifa
Copy link

This modification broke my code.

The @lupos idea was to be able to rename the class and not pick up the first descending elements.

Similar example code:

<div id="scene">
  <img src="..." class="layer" data-depth="0.05">

  <div class="team-one">
    <img src="..." class="layer" data-depth="0.075">
    <img src="..." class="layer" data-depth="0.1">
    <img src="..." class="layer" data-depth="0.125">
  </div>

  <div class="team-two">
    <img src="..." class="layer" data-depth="0.075">
    <img src="..." class="layer" data-depth="0.1">
    <img src="..." class="layer" data-depth="0.125">
  </div>
</div>

@reneroth
Copy link
Collaborator

Is there a reason you need to use containers instead of directly assigning the class names to the layer elements? I could implement an optional class selector for fringe cases like yours if there's no other solution.

@reneroth reneroth reopened this Jul 12, 2017
@amateur
Copy link

amateur commented Jul 24, 2017

This modification broke my code as well. This doesn't work for complicated HTML structure. For example I have three different containers which are used for styling and by other JS UI plugins. And I simply can't move the Parallax layer elements to the top of this structure.

I propose overriding layer elements only there are no elements with class .layer.

@reneroth
Copy link
Collaborator

Very good call, sorry to have caused such an inconvenience to you.
Maybe we could rectify the situation by adding an optional parameter that gets fed to querySelectorAll? So for those with special needs like yours, you could add a selector of .layer.

Would that work for you, @amateur and @caiotarifa

@amateur
Copy link

amateur commented Jul 24, 2017

@RROrg, yes, it works for me. Thanks!

@caiotarifa
Copy link

@RROrg, I think so. Thanks!

reneroth pushed a commit that referenced this issue Jul 24, 2017
@reneroth
Copy link
Collaborator

Please try the latest commit on master :)

@amateur
Copy link

amateur commented Jul 24, 2017

It works great! Thanks a lot.

@reneroth
Copy link
Collaborator

Thanks for your patience and understanding, all! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants