Hello, I have an interesting situation and I cannot determine what is wrong. I am trying to build a drag and drop category and product list. I am using jQuery UI's sortable function to do so. I am using the latest versions of jQuery and jQuery UI.
The lists are laid out as so:
<ul> // Top level categories
<li>TLC 1
<ul>Sub Category 1
<li>Cat A</li>
<li>Cat B</li>
</ul>
</li>
<li>TLC 2
<ul>Sub Category 2
<li>Cat C</li>
<li>Cat D</li>
</ul>
</li>
</ul>
My javascript is thus:
$(".admin-tree-sort-cat").sortable({
cancel: ".sort-button",
connectWith: ".admin-tree-sort-cat",
update: function(event, ui) {
var ids = $(this).sortable("toArray").toString();
$.ajax({
type: "POST",
url: "ajax/tree_order.php",
data: { ids: ids, cat: "1" },
success: function(data) {
alert(data);
}
});
},
placeholder: "ui-state-highlight"
});
Dragging from sub-category to top level category works fine. Dragging from sub-category to sub-category works fine. However dragging from top level category to sub-category only triggers the update on the top level category, not the sub-category, which means the change doesn't get saved. Why would dragging from sub-category to tlc work but not the other way round?
Firebug shows no errors and all the correct ajax calls, except for the missing one when dragging from tlc to sub cat.
I have a CMS system that uses SuperFish to build the menu on the front end. On the back end one of the most common comments we received was users found it hard to relate the back end menu to the front end menu. Our solution, make an editable copy of the front end menu in the back end. This involved combining the jQuery UI selectable feature with a SuperFish menu.
The initial integration works great. I have a menu bar with 2 tiers of drop down menus on them and I can move items around on the menu fine. I can select an item in a child menu and move it to it's parent fine, however I can't move an item to a child menu because whilst the drag feature is functioning hovering over a SuperFish menu doesn't open it.
What I need to do is try to find a suitable way to open all the child menus when select is active. I thought something like this would work:
start: function(event, ui) {
$('ul.main-menu').showSuperfishUl();
},
stop: function(event, ui) {
$('ul.main-menu').hideSuperfishUl();
}
However that just creates an ever increasing number of white spaces every time I move my mouse whilst dragging an item in a menu. Is there a way to open all of the child menus of the active select menu?
I have a tab, <div id="tab1">, that works perfectly fine. However I want to split the div up in two, so I used 2 divs inside, menu and content, so my DOM structure looks thus:
<div id="tabs">
<ul>
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
<li><a href="#tab3">Tab 3</a></li>
</ul>
<div id="tab1">
<div class="menu">
<h3>Menu</h3>
<br />
<ul>
<li><a href="#settings">Settings</a></li>
</ul>
</div>
<div class="content">
Settings go here...
</div>
</div>
</div>
Menu is floated left and content is floated right.
The problem is the height of the tab background doesn't extend down with the menu and content. Why not?
Hello all, I'm still relatively new to the world of developing websites (about 9 months now) and I've just discovered jQuery. Looks fantastic and an easy way to save me writing a lot of Javascript.
I wrote a demo login system, just for me to learn and as some example code I could show to prospective employers, with my own Ajax code in it. It worked great. All it does is send 2 variables to another page, ajax.php, which in turn echo's out the new information to be placed in the specified div. Now I'm trying to take out my code and use jQuery's Ajax, however I cannot get it to work and from the examples in the documentation I believe it should.
Can someone please take a look at this code and tell me why it isn't working?
function funcValUser(user) {
$(document).ready(function(){
if(user.length < 5 || user.length > 24) {
alert("Usernames must be between 5 and 24 characters. \nPlease enter a valid username.");
}
var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?~_";
for(var i = 0; i < user.length; i++) {
if(iChars.indexOf(user.charAt(i)) != -1) {
alert ("Usernames must only contain alphanumeric charactes. \nPlease enter a valid username.");