开发者

Too much recursion issue

Running into a recursion issue. Firebug says line 600:

  // Recurse if we're merging object values
  if (deep && copy && typeof copy === "object" && !copy.nodeType)
    target[name] = jQuery.extend(deep,
    // Never move original objects, clone them
    src || (copy.length != null ? [] : {})
    , copy); // <--- Line 600

Here's source:

$(function() {
  var $gallery = $('#gallery'), $matcher = $('#matcher');

  $('.rotatorImage', $gallery).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' });

  $('.rotatorImage', $galleryItems).draggable({ revert: 'invalid', helper: 'clone', appendTo: 'body', cursor: 'move' });

  $matcher.droppable({ 
    accept: '#gallery .rotatorImage, #galleryItems .rotatorImage', drop: function(ev, ui) {
      copyProduct(ui.draggable, $matcher);
    }
  });

  function copyProduct($item, section) {
    if (section.children().length == 0) {
        var cloneID = 'clone_' + $item.attr('id');
        var existing = $('#' + cloneID);
        if (existing.length == 0) {
            // then allow it to be created
            var clone = $item.clone();
            clone.attr('id', cloneID);
            clone.append('<div class="RemoveMatcherItem"><a href="javascript: RemoveItem(\'' + clone.attr('id') + '\');" class="greenlink">x</a></div>').appendTo(section);
            SaveChanges();
        }
    }
    else
        alert('Only one product is allowed at a time for this section.');
  }
});

function RemoveItem(cloneID) {
    $('#' + cloneID).remove();
    SaveChanges();
}

function SaveChanges() {
    SaveMatches();
    __doPostBack('<%=lnkSaveMatches.UniqueID%>', '')
}

function SaveMatches() {
  var $rotImg = $('#matcher').find('.rotatorImage');

  if ($rotImg.length > 0) {
      $rotImg.each(fu开发者_开发技巧nction() {
          var hdn = $('#<%=hdnMatcherID.ClientID%>');
          hdn.val($(this).attr('productID'));
      });
  }
  else
      $('#<%=hdnMatcherID.ClientID%>').val('');
}

<asp:HiddenField ID="hdnMatcherID" runat="server" />
<asp:LinkButton ID="lnkSaveMatches" runat="server" OnClientClick="return SaveMatches();" OnClick="lnkSaveMatches_Click" Text=""  />
<div id="matcher" class="matcher_" style="width: 120px; height: 120px; border: solid 1px; padding-left: 0px;">
  <div class="rotatorImage ui-draggable" id='clone_pid_<%# Eval("ProductID") %>' productid='<%# Eval("ProductID") %>'>
    <div style="height: 120px;">
        <asp:Image ID="imgProduct" runat="server" Width="120" /><br />  
    </div>
    <div class="RemoveMatcherItem"><a href="javascript: RemoveItem('clone_pid_<%# Eval("ProductID") %>');" class="greenlink">x</a></div>
  </div>
</div>

protected void lnkSaveMatches_Click(object sender, EventArgs e) {
  int matchID = hdnMatcherID.Value == "" ? 0 : Convert.ToInt32(hdnMatcherID.Value);

  Suggestion.UpdateSuggestionItem(matchID);
}

Any ideas on where I'm hitting my recursion issue?


Found the solution to my problem.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Changed it to:

<script type="text/javascript" src="js/jquery/jquery-ui-1.7.2.js"></script>

Thanks to those that assisted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜