开发者

help with jquery ui.helper[0] = null in IE6

开发者 https://www.devze.com 2022-12-25 14:39 出处:网络
i\'m trying to use jquery to implement a portlet/widget style interface, with 3 columns and drag and drop within and开发者_开发知识库 between them. it\'s working almost completely, except for issue th

i'm trying to use jquery to implement a portlet/widget style interface, with 3 columns and drag and drop within and开发者_开发知识库 between them. it's working almost completely, except for issue that it doesn't work in IE6

(function($) {
  $.fn.portlet = function() {
    return this.each(function() {
      $(this).sortable({
        connectWith: ['.portletColumn'],
        handle: 'h3',
        placeholder: 'drop',
        forcePlaceholderSize: true,
        start: StartDrag,
        stop: StopDrag
      });
    });
  };

  function StartDrag(event, ui) {
    try {
      //in ui.helper[0] is null and hence the issue
      //alert(ui.helper[0]);
      currentlyDraggedNode = this;
      alert(currentlyDraggedNode);
      ('.drop').css('height', jQuery(ui.helper[0]).outerHeight() + 'px');
      $('.portletColumn').css('background-color', '#eee');
    } catch (ex) { }
  }

  function StopDrag(event, ui) {
    try {
      $('.portletColumn').css('background-color', '#fff');
      UpdateOrder();
    } catch (ex) { }
  }

  function GetString(selector) {
    var querystring = "";

    $(selector).each(function() {
      var id = $(this).attr('id');

      if (id && id != '') {
        querystring += id + ';'
      }
    });

    return querystring;
  }

  function UpdateOrder() {
    var querystring = GetString('#col1 .portletColumn .portlet') + '|;' + GetString('#col2 .portletColumn .portlet') + '|;' + GetString('#col3 .portletColumn .portlet');
    $.get("/handlers/portlet.ashx?" + querystring);
  }
})(jQuery);


may I ask why you are using jQuery(ui.helper[0]) instead of jQuery(ui.helper) ? All the code I see in jQuery UI's source refers to it in that manner

0

精彩评论

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

关注公众号