Grow your CSS skills. Land your dream job.

Why is my “splitter” selecting text?

  • # April 4, 2013 at 1:29 pm

    I am trying to create a “splitter” on a page, and while I’m somewhat happy with how it’s working, I’ve noticed that as I drag it back and forth some text inside the flanking divs is getting selected. Is there any way to avoid this?

    [Here's a codepen I created that illustrates the problem](http://codepen.io/esdictor/pen/caieh “codepen example”)

    Thanks,
    Evan

    # April 4, 2013 at 9:32 pm

    @ESDictor

    Your calculating the position of your splitter incorrectly, so when the widths are set, it moved the splitter from under the cursor and give the div to left focus,

    Also, calculating a left margin for the right div is not really needed either, just float all the divs to the left,

    I also added some css to make the text none-selectable too, just encase we somehow slip off the Splitter

    I forked your pen here

    http://codepen.io/Podders/full/lwubs

    # April 5, 2013 at 9:13 am

    @Podders

    That works exactly how I wanted. Thank you very much for the solution.

    Evan

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".