Forum Discussion
Yeah, I probably don't want to do this. This thing is driving me nuts :)
I was trying before, to move the element with jquery, but no matter what kind of selector Iuse, it just won't budge.
I now have this:
<#assign msgId = env.context.message.id /> <@delegate /> <div id="custom-${msgId}" style="display:none">your content here</div> <@liaAddScript> ;(function($) { LITHIUM.Loader.onLoad(function(){ $("#messageview .message-uid-${msgId}").find(".lia-message-author-rank").append("#custom-${msgId}"); $("#custom-${msgId}").css("display", "block"); }); })(LITHIUM.jQuery); </@liaAddScript>
I've tried with parent(), children(), first(), this().parent().;anything I could think of, it just doesn't move an inch. It almost feels like the author section is getting some magical protection.
HI PerBonomi
I just spent a good hour trying to fix the same issue :)
Try replacing this:
$("#messageview .message-uid-${msgId}").find(".lia-message-author-rank").append("#custom-${msgId}");
with this:
$("#messageview .message-uid-${msgId}").find(".lia-message-author-rank").append($("#custom-${msgId}"));
You're basically passing a string to append while you should pass a jQuery object.
Nico
- PerBonomi11 years agoBoss
Hmm, it's still not moving, but I think your last comment has gotten me closer to figuring it out. Thanks for the help :)
- NicoB11 years agoLithium Alumni (Retired)
It's probably the selector which is not picking up the right element... unfortunately it's a trial and error exercise with DOM :)
Good luck!!
Nico
- PerBonomi11 years agoBoss
Got it! And I couldn't have done it without your help.
<#assign msgId = env.context.message.id /> <@delegate /> <div id="custom-${msgId}">your content here</div> <@liaAddScript> ;(function($) { LITHIUM.Loader.onLoad(function(){ $("#custom-${msgId}").prev().find(".lia-message-author-rank").append($("#custom-${msgId}")); }); })(LITHIUM.jQuery); </@liaAddScript>
Thank you thank you.