触发事件未被调用

时间:2012-03-28 07:25:54

标签: javascript jquery

我正在使用基于James Padolsey的jQuery autoResize插件。 在那个插件中,我试图绑定事件,当我做

$(this).trigger('keydown.dynSiz',doResize); within hideXDiv() function 
doResize doesn't get called... but $(this).trigger('keydown.dynSiz',doResize); in showXDiv() gets called.
Below is the code 

     textarea

                .unbind('.dynSiz')

                .bind('keyup.dynSiz', doResize)

                .bind('keydown.dynSiz', doResize)

                .bind('focus',showXDiv)

                .bind('focusout',hideXDiv)

                .bind('change.dynSiz', doResize);



      });


       doResize = function() {
        alert("...");
       }    

    showXDiv = function()

                {
                if(id != null)

                    {


                        $(this).trigger('keydown.dynSiz',doResize);   //get called!

                        $($(this).attr('mydiv')).show();

                    }

                }


    hideXDiv = function()
                {
            if(id != null)

                    {   
                        $(this).trigger('keydown.dynSiz',doResize); //this trigger doesn't happen....
                        $($(this).attr('mydiv')).slideUp();         

                    }

                }

0 个答案:

没有答案