I fixed it, if anyone has any tips for doing this more efficiently I
would appreciate them. Also, I still need to learn how to add
additional methods to my functions. For this one I'm trying to create
a destroy method that will destroy the draggable and unbind the
mouseenter zIndexing

(function($){
        $.fn.draganSort = function(options) {

                var opts = $.extend({}, $.fn.draganSort.defaults, options);


                //hold the current top element Zlocation
                var topZIndex = 0;
                return $(this).each(function() {
                        $this = $(this);

                        $this.draggable({
                                        containment: opts.container,
                                        ghosting: opts.ghost,
                                        opacity: opts.opac
                        });

                        //set initial zIndex of draggable element
                        $this.css('zIndex','300');

                        $this.mouseenter(function(){
                                //place element on top
                                var divZIndex = $(this).css('zIndex');
                                if($(this).css('zIndex') > topZIndex)
                                        topZIndex = $(this).css('zIndex');
                                ++topZIndex;
                                $(this).html(topZIndex);
                                $(this).css('zIndex',topZIndex);
                        }); //end mouseenter

                });
        };
        //$.fn.draganSort.extend({ destroy : function(){
                //              $this = $(this)
        //                      $this.draggable('destroy');
        //                      $this.unbind('mouseenter');
        //};
        $.fn.draganSort.defaults = {
                        container: 'parent',
                        ghost: true,
                        opac: 0.7
        };
})(jQuery);

Reply via email to