[][src]Function dragula::dragula_options

pub fn dragula_options<T>(objs: &[T], options: Options) -> Drake where
    T: JsCast + Clone

Activates the dragula drag-and-drop system with provided options

If you would like to customize the behaviour of the drag-and-drop systems past the defaults provided, you can call dragula_options and provide an Options instance to specify behaviour of certain drag-and-drop features.

Example:

use dragula::*;
use dragula::options::CopyValue;
use web_sys::Element;

let doc = web_sys::window().unwrap().document().unwrap();
let element_1 = doc.get_element_by_id("drag-container-1").unwrap();
let element_2 = doc.get_element_by_id("drag-container-2").unwrap();

let options = Options {
    moves: Box::new(|_el, _source, handle, _sibling| {
        Element::from(handle).class_list().contains("drag-handle")
    }),
    copy: CopyValue::Func(Box::new(|_el, source| {
        Element::from(source).class_list().contains("copy-container")
    })),
    ignore_input_text_selection: true,
    ..Options::default()
};

let drake = dragula_options(&[element_1, element_2], options);

Calling dragula_options will return a Drake, allowing you to interact with the active system managing drag-and-drop.