English 中文(简体)
j 退还“举报”
原标题:jQuery "array" is returned undefined

Namaste!

My simple issue is that $sortedData becomes undefined in the following code upon execution:

(function($) {
              $.fn.shuffle = function (){
                  var i = this.length, j, temp;
                  if ( i == 0 ) { return; }
                  while ( --i ) {
                      j = Math.floor( Math.random() * ( i + 1 ) );
                      temp = this[i];
                      this[i] = this[j];
                      this[j] = temp;
                  }
              };
            })(jQuery);

// DOMContentLoaded
            $(function() {
              // get the first collection
              var $cards = $( #cards );
              // clone cards to get a second collection
              var $data = $cards.clone();
              // call Quicksand when button clicked
              $( #shuffle ).click(function(e) {
                // get all the list items
                var $filteredData = $data.find( li );
                // random sort (shuffling)
                var $sortedData = $filteredData.shuffle();
                // finally, call quicksand
                $cards.quicksand($sortedData, {
                  duration: 600,
                  easing:  easeInOutQuad 
                });
              });

            });

如何要求: 我有一个顿子,在被点击时,执行上述法典。

我检查了sh子功能中的数值,在要求穿透功能之前,但是,当sh子功能返回时,没有界定 $子。

The error is probably a noobish one, but, I can t see it.

感谢你的投入!

最佳回答

你的“衣着”功能不会恢复任何东西,但你却把它当作是这样。 这似乎在place。

问题回答

暂无回答




相关问题
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.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签