We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16360
    • 15 Posts
    Hi

    Im working on project where I have list of items [!Wayfinder? &startId=`21` &level=`2 &rowTpl=`row_template` !] and I want to show image thumbnail of each item after "on mouseover" on hyperlink - something like: http://www.templatemonster.com/ but on text hyperlink not image....

    Each document has template varible [*productimage*]

    Appreciate any help...


      • 16360
      • 15 Posts
      Figured out myself... maybe someone will need it to so here`s a solution:

      Put this simple js to template code:

      script type="text/javascript">
      function Show_Image(IDS) {
        document.getElementById(IDS).style.display = "block";
      }
      function Hide_Image(IDS) {
        document.getElementById(IDS).style.display = "none";
      }
      </script>



      template for Wayfinder &rowTpl

      <li>
      <a href="[+wf.link+]" onMouseOver="Show_Image('[+wf.docid+]')" onMouseOut="Hide_Image('[+wf.docid+]')">[+wf.linktext+]</a> - [+wf.description+]  [+wf.wrapper+] </a>
      <span id="[+wf.docid+]" style="display:none">
      <img src="[+productimage+]" alt="Product image" /></span>
      </li>
      


      in my example list is very long so I add some css to display picture next to the list

      CSS
      #mydiv span
      {
      position: fixed;
      top: 250px;
      right: 300px;
      }



      Hope thats helpfull
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Thanks for sharing your solution!


        As a side note, you forgot to enclose the onmouseover attribute in quotes in your template.. it may not hurt at this moment but better make it safe then to be sorry. And it seems odd to me to use a span to contain the image, I personally would’ve probably used a div.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 16360
          • 15 Posts
          Corretto! Thanks for your attention...