質問

jquery UI選択可能なデモページ: http://jqueryui.com/demos/selectable/#default 要素を選択すると、選択ボックスのアウトラインが表示されます。私がそれを試してみると、どうしてこれが現れないのですか?

これは私のフィドルではありませんが、同じ問題もあります。http://jsfiddle.net/jmdvm/40/

役に立ちましたか?

解決

それは、選択ヘルパーボックスをスタイリングするためのクラスが含まれるjQuery UI StyleSheetを欠いているためです。以下をCSSに追加します。

.ui-selectable-helper {
  position: absolute; 
  z-index: 100; 
  border: 1px dotted black; 
}

$(document).ready(function() {
  $("#selectable").selectable({
    selected: function(event, ui) {
      $('.status').text("Selected");
    },
    selecting: function(event, ui) {
      $('.status').text("Selecting");
    }
  });
});
#wrapper {
  width: 250px;
  height: 100px;
}

#selectable {
  background: black;
  width: 250px;
  height: 16px;
}

#selectable .ui-selecting {
  background: silver;
}

#selectable .ui-selected {
  background: gray;
}

#selectable div {
  background-color: #777;
}

.ui-selectable-helper {
  position: absolute;
  z-index: 100;
  border: 1px dotted black;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.js"></script>
<div id="wrapper">
  <div id="selectable">
    <div>Hello</div>
    <div>Select</div>
    <div>Me</div>
  </div>
</div>
<div class="status"></div>

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top