views:

25

answers:

1

Hi all,

I have a little problem with the Jqueri UI Stack

$('.dra').draggable({ addClasses: false, containment: 'window', zIndex: '9999', stack: '.sta'});

The problem is that all DIVs with the class .dra are with stack. But i only want all div with the class .dra and with the second class .sta with stack.

or must i say

$('.dra .sta').draggable({ addClasses: false, containment: 'window', zIndex: '9999', stack: '.sta'});
$('.dra').draggable({ addClasses: false, containment: 'window', zIndex: '9999'});

i dont understand it. For what is the value after stack: ?

Can anybody help me? kind regards Peter

A: 

If you want only class="dra sta" and not all .sta elements, then you need to use both classes in the selector, you can do that by leaving no space between the .class selectors, like this:

$('.dra').draggable({ 
  addClasses: false, 
  containment: 'window', 
  zIndex: '9999', 
  stack: '.dra.sta'
});

If you don't have a space, it only matches elements with both classes. You need a specific selector here because it's not checking against the .dra elements only, but rather using that text literally as the selector, with no restriction (for example the above translates to $('.dra.sta')), you can see the source here.

Nick Craver
Hi Nick,thanx for the fast answer.dra = draggablesta = stackall DIVs with class dra are draggable and when the div has the second class sta = draggable with stackThis code work $('.dra.sta').draggable({ addClasses: false, containment: 'window', zIndex: '9999', stack: '.dra.sta' }); $('.dra').draggable({ addClasses: false, containment: 'window', zIndex: '9999' });Is this way ok? greetz from GermanyPS: I hope u understand what i mean .. my english is not so good ;)
Peter
@Peter - That should work just fine, if my understanding of what you *want* is correct. Though, I'm not 100% clear on your intentions from the description...if you had a link I'd be happy to take a look.
Nick Craver
ok, nice :)coz i thought the class ".dra" is than double draggable. Thx 4 the rly fast help and have a nice day :)
Peter
@Peter - Welcome :) If this resolved your issue be sure to accept the answer via the checkmark on the left...if it didn't please post what problem you're still having :)
Nick Craver