(jQuery插件)拖&在多项选择测验中放弃答案 [英] (jQuery plugin to) drag & drop answers in multiple choice quiz

查看:154
本文介绍了(jQuery插件)拖&在多项选择测验中放弃答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作网页,用户必须在测验中从两个列表中连接元素。例如,假设一个测验问题,你有两个列表,一个是国家,一个是资本,用户必须将资本连接到正确的国家。

I'm making a webpage where the user has to connect elements from two lists in a quiz. For example, imagine a quiz question where you have two lists, one with countries and one with capitals, and the user has to connect the capitals to the correct countries.

应该有一种方式让用户将元素从第二个列表拖到第一个列表元素旁边。像这样:

Preferably, there should be a way for the user to drag the elements from the second list to an area next to the elements of the first list. Like this:

在这里,您可以将蓝色框拖入灰色矩形。

Here, you would drag the blue boxes into the gray rectangles.

是否有一个jQuery插件或其他JavaScript库这样的事情呢?还是我必须自己实现?如果是这样,有没有人指向描述类似问题的解决方案的文章,或者想法如何最好地解决这个问题?

Is there a jQuery plugin or other JavaScript library that does something like this already? Or do I have to implement it myself? If so, does anyone have some pointers to articles describing solutions to similar problems, or ideas on how one can best solve this?

推荐答案

考虑使用 jQuery UI droppable ?它几乎是你想要的东西。只需将灰色框设置为droppable,并将蓝色框设置为可拖放。

Considered using the jQuery UI droppable? It does pretty much the thing you want. Just set the gray boxes as droppable and the blue ones as draggable.

您可能会使用还原选项

这篇关于(jQuery插件)拖&在多项选择测验中放弃答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆