English 中文(简体)
冲洗国防部
原标题:Shuffling the DOM

我使用下面的洗牌脚本 随机排列我网站上某个Divs的顺序

http://james.padolsey.com/javascription/shouffling-the-dom/

脚本有效, 但只能随机设定 < strong_ code>. content div , 而不是 < strong_ code >. step , 这样图像就会被混淆 。

是否有方法选择 all 中 < code>. step 的内容?

<div class="step">
<div class="content">
  <h2>title</h2>
  <p>text</p>
  <a href="#">link</a>
</div>
<img src="./images/1.png" />
</div>

$(  .step div  ).shuffle();
问题回答
$(  .step  ).shuffle();

只需删除内部 div 选择器 。

i read the link you posted did you used the plugin $.fn.shuffle or the second one "untested say by the author" if you used the first one as i think the you should read carefully at the top page of the link it says

** ** ** **

I was recently looking for a decent way of shuffling a set of elements. I found a jQuery plugin which claimed to do exactly that but unfortunately it only works if all elements are direct descendants of a single parent, like all list items under an unordered list.

** ** ** **

加上我的密码HTML

<div class="content">
  <p>文字1</p>
</div>
 <div class="content">
  <p>文字2</p>
</div>
<div class="content">
  <p>文字3</p>
</div>


<div class="content">
  <p>文字4</p>
</div>
 <div class="content">
  <p>文字5</p>
</div>
<div class="content">
  <p>文本6</p>
  <img src="./images/1.png" />
</div>

but again it only works if all elements are direct descendants of a single parent, like all list items under an unordered list

工作很好,但很精准

i 使用了下面的脚本, 并在 div 元素 中插入图像 < strong >

 $("document").ready(function() {
       $("div").shuffle();
 });

输出输出

文字5

文字3

文字4

文字2

文字1

文本6

他们忽然地摇摆着,

$( div. step ).shuffle (); 应该有所帮助 。

你能展示一下你的全HTML吗?





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签