var original = self.element.find('img.original').get(0);
self._original = false;
+ self.original_loeaded = undefined; // callback
+ self._original_loaded = false;
+
+ self.spinner = $("#spinner").progressSpin();
+
+ $(original).load(function() {
+ console.log("loaded original");
+ self._original_loaded = true;
+ self.spinner.stop();
+ var cb = self.original_loaded;
+ self.original_loaded = undefined;
+ if (cb)
+ cb()
+ });
if (self.options.max <= 0) {
self.options.max = original.naturalWidth
});
self.element.offset(self.initial_position);
- self.element.draggable({containment:"parent"});
+ // self.element.draggable({containment:"parent"});
if (self.options.plus_button)
self.options.plus_button.click(
return self;
},
- natural_size: function() {
- var img = this.element.find('img').get(0);
+ natural_size: function() {
+ var img = this.element.find('img.original').get(0);
return [ img.naturalWidth, img.naturalHeight ]
},
currentZoom: function() { return this._zoom; },
initOriginal: function() {
+ var self = this;
+ function subst_original() {
+ self.element.find("img.initial").remove();
+ self.element.find("img.loading").removeClass("loading");
+ self._original = true;
+ }
if (!this._original) {
- this.element.find("img.initial").remove();
- this.element.find("img.loading").removeClass("loading");
- this._original = true;
+ if (this._original_loaded) {
+ return subst_original();
+ } else {
+ self.original_loaded = subst_original;
+ self.spinner.start();
+ }
}
},
};
this._zoom = level;
- this.element.animate(target, 200); // default duration=400
+
+ this.element.css(target);
+
+
+// this.element.animate(target, 1200); // default duration=400
},
allowedPosition: function(off) {
$($t.attr('href')).hide().insertAfter(this);
});
- $('.toolbar a.dropdown').toggle(function() {
- $(this).addClass('selected');
- $($(this).attr('href')).slideDown('fast');
- }, function() {
+ function closeDD() {
$(this).removeClass('selected');
$($(this).attr('href')).slideUp('fast');
+
+ }
+ $('.toolbar a.dropdown').click(function() {
+ if ($(this).hasClass('selected')) {
+ closeDD.call(this);
+ } else {
+ $(this).addClass('selected');
+ $($(this).attr('href')).slideDown('fast');
+ $(this).parent().siblings(".button:has(.dropdown)").children(".dropdown").each(closeDD);
+ }
});