Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Why is my “splitter” selecting text?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #43889
    ESDictor
    Participant

    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

    #130613
    Podders
    Participant

    @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

    #130728
    ESDictor
    Participant

    @Podders

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

    Evan

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.