Jquery Draggable and Stack and sec. CLass?
I have a little problem with the jQuery 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 i开发者_运维问答t. For what is the value after stack: ?
Can anybody help me? kind regards Peter
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.
精彩评论