addClass converting from JQuery to MooTools
I have Kunena forum template for Joomla that use MooTools 1.4. I
integrated in this theme bootstrap tooltip functionality and addedd
MooTools addClass to trigger tooltips in some classess. I checked MooTools
doc's and the code should looks like below:
$$('h3 a, .tk-page-header h1 .tk-latestpost a, .tk-topic-title a,
.tk-topic-info a, .tk-preview-avatar a, .tk-social-icons a,
.kpost-user-icons a, .kicon-profile, .tk-user-info-body li a,
span.kkarma-plus, span.kkarma-minus, .btnImage').addClass(' hasTooltip');
Above code can be seen on http://jsfiddle.net/AgpbL/ (scroll to the bottom)
Unfortunately it doesn't work, so I created jQuerry script
jQuery(document).ready(function(a){
a("h3 a, .tk-page-header h1 .tk-latestpost a, .tk-topic-title a,
.tk-topic-info a, .tk-preview-avatar a, .tk-social-icons a,
.kpost-user-icons a, .kicon-profile, .tk-user-info-body li a,
span.kkarma-plus, span.kkarma-minus, .btnImage").addClass("
hasTooltip");
});
(jQuery);
and it works very well itself. Unfortunately it cause a conflict with
MooTools so I went back to MooTools and (after searching stackoverflow) I
created another code:
$$('h3 a, .tk-page-header h1 .tk-latestpost a, .tk-topic-title a,
.tk-topic-info a, .tk-preview-avatar a, .tk-social-icons a,
.kpost-user-icons a, .kicon-profile, .tk-user-info-body li a,
span.kkarma-plus, span.kkarma-minus, .btnImage').addEvents({
'mouseenter': function() { $(this).addClass(' hasTooltip'); },
'mouseleave': function() { $(this).removeClass(' hasTooltip'); }
});
and no effect again.
Comparing basic myElement.addClass(className); MooTools to .addClass(
className ) jQuery I couldn't find big differences but obviously something
is wrong I'm not able to understand.
Any help or pointing to elsewhere is much appreciated.
No comments:
Post a Comment