align_type: null,
direction: 1,
container: null,
+ orientationEventFire: false,
_resize: function ( index ) {
var img = this.images[index],
this.align_type = $( this.element ).jqmData( 'vertical-align' );
- $( window ).bind( 'resize', function () {
- self.refresh();
+ $.extend( this, {
+ _globalHandlers: [
+ {
+ src: $( window ),
+ handler: {
+ orientationchange: $.proxy( this, "_orientationHandler" ),
+ resize: $.proxy( this, "_resizeHandler" )
+ }
+ }
+ ]
+ });
+
+ $.each( this._globalHandlers, function( idx, value ) {
+ value.src.bind( value.handler );
});
},
this._detach_all();
},
-
+ _resizeHandler: function() {
+ var self = this;
+ if( self.orientationEventFire ) {
+ self.refresh();
+ self.orientationEventFire = false;
+ }
+ },
+ _orientationHandler: function() {
+ var self = this;
+ self.refresh();
+ self.orientationEventFire = true;
+ },
refresh: function ( start_index ) {
this._update();
}
this.refresh( index );
+ },
+
+ destory: function() {
+ $( window ).unbind( 'resize', this._resizeHandler );
+ $( window ).unbind( 'orientationchange' , this._orientationHandler );
}
+
}); /* End of widget */
// auto self-init widgets