I have a solution which is on the one hand not the cleanest ones and
on the other hand not update save:
The ui.tabs-rotation stuff knows whether it was a real click or not. I
added a stoppedWithTrueClick variable and changed that from false to
true (marked as /* ugly */ in the code).
/*
* Rotate
*/
$.extend($.ui.tabs.prototype, {
rotation: null,
stoppedWithTrueClick: false,
rotate: function(ms, continuing) {
var self = this, o = this.options;
var rotate = self._rotate || (self._rotate = function(e) {
clearTimeout(self.rotation);
self.rotation = setTimeout(function() {
var t = o.selected;
self.select( ++t < self.anchors.length ? t : 0
);
}, ms);
if (e) {
e.stopPropagation();
}
});
var stop = self._unrotate || (self._unrotate = !continuing ?
function(e) {
if (e.clientX) { // in case of a true click
self.rotate(null);
jQuery.ui.tabs.prototype.stoppedWithTrueClick =
true; /* ugly */
//
self.stoppedWithTrueClick not working, better to say I dunno how to
access it from outside
}
} :
function(e) {
t = o.selected;
rotate();
});
// start rotation
if (ms) {
this.element.bind('tabsshow', rotate);
this.anchors.bind(o.event + '.tabs', stop);
rotate();
}
// stop rotation
else {
clearTimeout(self.rotation);
this.element.unbind('tabsshow', rotate);
this.anchors.unbind(o.event + '.tabs', stop);
delete this._rotate;
delete this._unrotate;
}
}
});
So there's still a need for a clean solution.
On Jan 6, 9:01 am, dalori <[email protected]> wrote:
> Thanks for your reply, but it does not work.
>
> The content of the event element is quiet clear:
> - currentTarget pointing at the tabs div
> - jQuery1262764471648 being set to true
> - result being undefined
> - target (almost the same like currentTarget)
> - timeStamp being 1262764...
> - type "tabshow"
>
> No difference between a tab being clicked or a tab being displayed
> automatically by rotation.
>
> Any idea? Using jQuery 1.3.2 and UI 1.7.2.
>
> On Dec 30 2009, 3:09 pm, Scott González <[email protected]>
> wrote:
>
>
>
> > When you bind to the tabsshow event, you can check if
> > event.originalEvent exists. If it does, then the event was triggered
> > by the user and will contain the event corresponding to the user's
> > action, e.g., a click event.
>
> > On Dec 29, 6:30 am, dalori <[email protected]> wrote:
>
> > > I have a problem with the tabs in combination with the automatic tab
> > > rotation:
>
> > > Is it possible to get the set speed of the rotation
> > > - or -
> > > if the "tabsshow" event was invoked manually or by the automatic
> > > rotation?
>
> > > The reason why I am asking that is the following: I am trying to build
> > > tabs with images. One tab could be either an image itself or several
> > > images with only one label.
>
> > > The display flow should be the following:
> > > - show image tab 1 (using auto-rotation)
> > > - show image tab 2 (using auto-rotation)
> > > - show image tab 3 (using auto-rotation) containing several images
> > > - stop auto-rotation
> > > - show inner image 1
> > > - show inner image 2
> > > - show inner image 3
> > > - start auto-rotation again <-- ONLY when the tab was displayed
> > > automatically and not if a user has clicked the tab manually. In that
> > > case it should stop on the last image
> > > - show image tab 4
>
> > > Does anybody know a clean solution?- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.