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

Resize of row/column is not working when Split() is included directly in html (instead of separate script) #799

Open
abhijithda opened this issue Mar 21, 2024 · 1 comment

Comments

@abhijithda
Copy link

abhijithda commented Mar 21, 2024

Resize of row/column is not working when below Split() is included directly in html with <script> tags, whereas it works perfectly fine when included as part separate js file.

Resize doesn't work when Split() is included in html within <script> tags

Example: https://jsfiddle.net/uca6wh0o/

<script>
  Split({
    columnGutters: [{
      track: 1,
      element: document.querySelector('.vertical-gutter'),
    }],
    rowGutters: [{
      track: 1,
      element: document.querySelector('.horizontal-gutter'),
    }]
  })

</script>

<div class="grid">
  <div>
    HTML
  </div>
  <div>
    CSS
  </div>
  <div>
    JS
  </div>
  <div>
    Result
  </div>
  <div class="horizontal-gutter">
  </div>
  <div class="vertical-gutter">
  </div>
</div>

Resize works when Split() is part of js

https://jsfiddle.net/oskar/rcqkox3t/

@jy14898
Copy link

jy14898 commented Jul 5, 2024

In the HTML case, your script is running before the elements have been created. To illustrate this, add console.log(document.querySelector('.vertical-gutter')); somewhere in the script tag

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

2 participants