Git Product home page Git Product logo

Comments (4)

thenutjob avatar thenutjob commented on August 27, 2024

Figured it out. I'm using bootstrap tabs. It looks like the tab has to be active for it to load properly. Previously I was loading it on page load. I switched it to load when the tab becomes active for the first time and that fixed it. I think the disabling height, then dragging the splitter, and then re-enabling the height caused it to reinitialize and fix itself if I were to guess. Regardless, could this be made to work when it is not currently visible so my fix wouldn't be necessary?

from split.

thenutjob avatar thenutjob commented on August 27, 2024

Ok, this is really weird. Looks like I need a bit of a delay too. With only 100 milliseconds delay, the height is off a bit on the bottom div. If I use 500 millisecond delay, it works fine. Also, I have to manually set the height of the bottom div on load or else the size of the bottom div is way off and puts elements off-screen. Ended up getting it working but have to use this it seems, unless there is a better way:

 setTimeout(function() {
     Split(['#topDiv', '#botDiv'], {
        "direction": 'vertical',
        "sizes": [15, 85],
        "minSize": [75, 0],
        "gutterSize": 15
    });
    $('#botDiv').height('370px');
 }, 500);

from split.

nathancahill avatar nathancahill commented on August 27, 2024

Split.js depends on the container having layout when it's initialized. Can you make a simple JSFiddle that recreates the height issue?

from split.

thenutjob avatar thenutjob commented on August 27, 2024

It's all good. After I moved it to the "tab active code" it works now with no delay (but still have to set the height, but I don't really mind much since it's just one short line of jQuery). Final code:

$(document).on('shown.bs.tab', 'a[href="#tab-splittertab"]', function() {
  if (splitterLoaded) { return; }

  Split(['#topDiv', '#botDiv'], {
    "direction": 'vertical',
    "sizes": [15, 85],
    "minSize": [75, 75],
    "gutterSize": 15
  });

  $('#botDiv').height('370px');
  splitterLoaded = true;
});

from split.

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.