I have successfully managed to hack together (with the help of other posts), this example
here (code and live example)
which is a jQuery UI sortable and selectable comprised of three connected lists. There is also a restriction on it so that only one item may be selected at a time.
If you look at the demo you will see that selection is only possible across items of the same list. My question is how I can make selection go across multiple connected lists.
Any help is much appreciated.
Try wrapping around your sortables with a div. For example: <div id="sortables">.
Then change your selector from:
$("#list1, #list2, #list3").selectable
to:
$("#sortables").selectable
Then add this line as a selectable option:
filter: "li",
This way will make only the <li> elements selectable within the "sortables" div.
Related
I have a requirement where in I have to create a multi select drop down where the elements can be searchable and the count of selected items should be displayed upon selection.
I have found the partial part of the requirements at this link
But not sure how to make the drop down collapsible and expandable
Wire frame image as below
Has anyone come across and worked on such requirements?
Well it depends also a bit if you are using plain Javascript or if you are also using a Framework like Angular/vue/ember or so
here is one component that looks like it makes what you want
http://selectize.github.io/selectize.js/
I have been trying to build a multi-level vertical tabs with hidden content which gets visible by some jquery. It is working fine but with it has one problem.
Because of this code:
$(this).nextUntil("li.tabsclose").slideToggle();
When page loads for the first time, all the parent categories are shown but if you click on a category with some sub-categories, jquery hides everything until the next item with "tabsclose" class. Which is a problem because I have some Parent categories towards the end of the list.
Here is the jsfiddle: https://jsfiddle.net/ebf6cdpe/
Thank you very much for your help in advance!
SOLUTION:
After spending some considerable time on searching web, I have used if/else statement to be able to close parent tabs on re-click.
https://jsfiddle.net/ebf6cdpe/5/
This particular piece is causing all the Parent categories without subcategories to be hidden:
$('.subtabs').not(this).nextUntil(".subtabs").slideUp();
If you remove that, all the Parents without subcategories won't disappear permanently. However, there is still an issue with them temporarily disappearing when opening the subcategory.
You need to have a class that is applied to all your parents that you can use as a selector in this loop:
$(this).nextUntil("li.tabsclose").slideToggle();
I'm still not 100% sure this is the exact functionality you want, but here is an updated version:
https://jsfiddle.net/ebf6cdpe/1/
Whatever the case, you may be better off using nested lists for your subcategories. https://www.w3.org/wiki/HTML_lists
I want to make some divs which I can select.
JSFIDDLE
I also want to shift select the divs and multiple dives should only be selected if the user press crontroll (like in a normal windows explorer).
How can I do that?
A few years back I tried to make my own tree viewer that allowed fancy selecting features and expanding using divs and CSS. I found it much easier to use the select tag, with the size attribute so it wasn't a dropdown, the multiple attribute to give me fancy selecting abilities, and option groups to denote parent child relationships. Is that an option for you?
You can use jQuery UI library to achieve this quickly and efficiently. It works with CTRL key but not sure about SHIFT key.
Here's the link: http://jqueryui.com/selectable/
I am working on a Drag&Drop Dashboard, part of it is written with AngularJS.
I am using a select for my Dropdown-Menu:
<select ng-model="selected_option" ng-options="object.id for object in options"></select
When i select an option, i show a list of related elements:
<li ng-repeat="option in selected_option.columns"><div class="alert alert-success">{{option.header}}</div></li>
So, when i Drag&Drop the list-element to my "board" (inside given divs), and change the selected option again, all related elements are gone.
This is working as it should, of course.
But how to prevent the removing of my elements which are "draged" to
the board?
Summarize:
I have a list of elements via ng-repeat on the left.
I drag them to the right side (to my board). I wanted them to stay
there, even if i change the select.
If i drag them again to the list on the list, they should be gone
when i reselect the dropdown.
EDIT: A small JSFIDDLE
Or would it be nicer to do everything with jQuery? I love the 2-Way-Data-Manipulation from Angular, but if this ng-bind removing is too much work, i could also do it with jQuery.
I'm trying to create a product page layout that allows a customization of a product. Basically, a series of drop downs with each successive drop down populated with options based on what has been selected so far. So like this:
Drop down 1: Product Variant (user selects productvariationb, drop down 2 then is populated with options for productvariationb).
Drop down 2: Product color (user selected productvariationb in drop down 1, now that they select "brown" in drop down 2 the image should change to a brown version of productvariation b).
And so on, with the image changing (and options populating) each time according to what has been selected.
Can I do this with JS and does anyone know of a script similar that I can edit, or what functions of JS I need to look into to accomplish this?
Here I made you this : http://jsfiddle.net/moeishaa/H9fF2/
It is working with jQuery. Play with it and let me know if this helped :-)
I know it looks very static but you can render the drop-down on page load and populate the options object as well. I am sure you can find plug in and add-ons. This is a very short amount of code and can be customized.
I think the best resource for example code would be looking at some JavaScript or JQuery examples on creating expandable menus (more specifically ones that mimic folder structures). They usually operate by decorating an unordered list.
You could create a static unordered list and have the image change based on what item you are hovering over. Alternatively, you could use some AJAX to dynamically populate additional parts of the list as you hover over different levels. Both of those would most likely be easily accomplished with JQuery. Here's a page with some menu examples that might give you some ideas:
JQuery Navigation Menus