Closed zathrus-writer closed 11 years ago
Hi Martin,
The plugin will check to see if mtabs has already been applied, so I think if two different scripts are applying mtabs()
to the same element then the one that is executed first should be the one that is successfully applied.
I haven't tested this, however. Probably worth writing a specific test for this perhaps...
An onCreate event to subscribe to could be handy though. I'll take a look at implementing this.
Thanks for the input.
Nice :)
You are right in that there is no duplicate tabs creation if they were already initialized. I didn't check what mTabs() call actually returns. If it returned false in case of an existing instance on the element in question, that would help as well. Otherwise, a onCreate event would be very welcome :)
Martin
amazing stuff, will give this a test tomorrow for sure - thank you!
Cool thanks. Hopefully that helps.
Been testing this and it seems to work quite well :) The only thing I'm missing there is probably a reference of the element from which tabs were created. This is so I could determine which container was activated when I subscribe do the onReady event.
But that shouldn't be too hard on my side here. Thanks again!
Interesting idea. Perhaps I could pass a jQuery element of the tab set as an argument to the onReady
function for you? Would be useful if you were applying .mtabs
to multiple elements at once, like this:
$('.set-1, .set-2').mtabs({
onReady: function ($set) {
// $set will be either '.set-1' or '.set-2'
}
});
Then again, you might just be able to use $(this)
within the callback...
I'll investigate.
Actually, you probably won't be able to use $(this)
as the callback will be invoked with a different context. Let me look at adjusting this.
Thanks man.
hmm, didn't think about the context consequence... will wait and see what you'll be able to come with then :) and thanks to you, mate
Hey Martin,
I'm now passing in the element that .mtabs
was invoked on as the context for the .onReady
callback, so this should allow you to use $(this)
within the function for whatever you need.
Let me know if that helps.
Thanks.
This is most helpful, thank you!
Cool man. I'll create a proper release for this later on then.
Thanks.
Hi,
I just came across an interesting case, when 2 concurrent scripts tried to mtabs() the same element. Naturally, only one of the succeeded, and there was no knowing which one that was.
What I'd love to see in this plugin is an event that fires when tabs are built, so I could subscribe to that event in the second script and do what is needed to be done once it's fired.
Martin