I'm currently facing an issue with jQuery that I need help solving.
Here's the scenario: I am creating tooltips and positioning them directly under a specific trigger using CSS. Everything is functioning correctly, but there is one problem:
In my content, I have a <p>
tag containing text. The tooltip is activated by the first word of this text, and due to the alignment, the beginning of the tooltip extends outside of the viewport.
This results in a situation like this:
My goal is to use jQuery to target the first word specifically, allowing me to adjust the tooltip position accordingly. Essentially, I would like to write a function like:
if( isFirstWord == true ) {
tooltip.css('left','xx%')
}
This way, I can ensure that the tooltip is positioned correctly only when it pertains to the first word of the text.
If my explanation is unclear, please feel free to leave a comment so I can provide more details. Any assistance on this matter would be greatly appreciated.