javascript - Is it possible to draw a rectangle with mouse to select multiple DIVs? -
i want drag rectangle mouse select divs.
the selected div change class “no” “yes”. also, a
link clickable , dblclickable
<div id= "container" > <div id="div-1" info="info1"> <div class="no" id="inside"> <a href="#">something</a> </div> </div> <div id="div-2" info="info2"> <div class="no" id="inside"> <a href="#">something</a> </div> </div> <div id="div-3" info="info3"> <div class="no" id="inside"> <a href="#">something</a> </div> </div> <div id="div-4" info="info4"> <div class="no" id="inside"> <a href="#">something</a> </div> </div> </div>
using jquery ui selectable, code adds yes
class selected divs , adds no
class when div deselected. code looks this:
$(document).ready(function(){ $("#container").on("selectableselected selectableunselected", function(){ $(".inside").removeclass("yes").addclass("no"); $(".ui-selected > .inside").removeclass("no").addclass("yes"); }); });
(i had change inside
id class since uses multiple elements.) solution anchor tags not working inside of selectable here: https://bugs.jqueryui.com/ticket/4236
Comments
Post a Comment