Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单击图像时jQuery shuffle div_Javascript_Html_Css_Button_Shuffle - Fatal编程技术网

Javascript 单击图像时jQuery shuffle div

Javascript 单击图像时jQuery shuffle div,javascript,html,css,button,shuffle,Javascript,Html,Css,Button,Shuffle,我试图使用一个按钮作为图像,将洗牌一块文本 很抱歉,如果这是一个非常基本的问题,我只是在将它应用到我当前的jQuery时遇到了问题。您的.headline1类的开始和结束标记中似乎有一些错误。首先需要通过定义id(如$('#refresh'))来正确定义refresh click函数。click()。 我假设您需要与您的解决方案类似的东西: $(function () { $('#refresh').click(function() { var parent = $(".headline1")

我试图使用一个按钮作为图像,将洗牌一块文本


很抱歉,如果这是一个非常基本的问题,我只是在将它应用到我当前的jQuery时遇到了问题。您的
.headline1
类的开始和结束标记中似乎有一些错误。首先需要通过定义id(如
$('#refresh'))来正确定义refresh click函数。click()
。 我假设您需要与您的解决方案类似的东西:

$(function () {
 $('#refresh').click(function() {
var parent = $(".headline1");
var divs = parent.children();
while (divs.length) {
       parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]);
     }
  });
});

查看此

这正是我所追求的,如此简单的解决方案!谢谢,非常感谢