i'm beginner @ jquery. create selectable portlet, , when clicked showed same portlet in second tab immediately.
this javascript code.
$(function () { $(".frame").sortable({ connectwith: ".frame", handle: ".portlet-header", placeholder: "portlet-placeholder ui-corner-all" }); $(".portlet") .addclass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all") .find(".portlet-header") .addclass("ui-widget-header ui-corner-all") .prepend("<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>"); $(".portlet-toggle").click(function () { var icon = $(this); icon.toggleclass("ui-icon-minusthick ui-icon-plusthick"); icon.closest(".portlet").find(".portlet-content").toggle(); }); }); $(function () { $(".frame").selectable({ stop: function () { var result = $("#select-result").empty(); var add = $("#newexam").empty(); var count = 0; $(".ui-selected", this).each(function () { if (this.id > 0) { result.append(this.id + " "); count = count + 1; } }); add.append(count); } }); }); and html code.
<div id="tabs"> <ul> <li><a href="#master">master</a></li> <li><a href="#creation">add list <span id="newexam" class="badge" >0</span> </a></li> </ul> <div id="master" class="master"> <p>exam in collection</p> <br /><br /> <p id="feedback"> <span>you've selected:</span> <span id="select-result">none</span>. </p> <div class="frame" style="align-content: center"> <div class="portlet portlet-count" id="1"> <div class="portlet-header">first</div> <div class="portlet-content">test</div> </div> <div class="portlet portlet-count" id="2"> <div class="portlet-header">second</div> <div class="portlet-content">test</div> </div> <div class="portlet portlet-count" id="3"> <div class="portlet-header">third</div> <div class="portlet-content">test</div> </div> </div> </div> <div id="creation"> </div> p.s. master first tab, creation second tab.
Comments
Post a Comment