简体   繁体   中英

popup text box on hover without access to html?

Im trying to create a popupbox with text on mouseover. My problem is that I dont have access to the html, and I cant upload javascript- I can however do css and write Javascript.

Most example I find either requires you to change the cssclasses, or upload a Javascript. Since I cant link in internal script, that fails.

Can I do this with Javascript without the need to upload a scriptfile?

hmtl example, where the span class is the one I need to target:

<a href="/products/Microsoft/All-in-One-Media-Keyboard-with-TouchPad-German-?prodid=1676284">All-in-One Media Keyboard with TouchPad German  <span class="labelextension N2">Bulk</span> </a>

This is a VERY crude example on how to do what you described:

  • get the triggering element ( $('.labelextension') )
  • create an element that is going to be the popup ( popup = document.createElement(...) )
  • attach the element to the triggering element ( ...appendChild(popup) )
  • change its css so that it is only displayed when the mouse hovers the triggering element ( popup.classList.add('tooltip') and .tooltip {display:none} .labelextension:hover .tooltip {display : inline;} )

A rather crummy JSFiddle here: http://jsfiddle.net/kcdagqdn/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM