We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17705
    • 501 Posts
    I have several documents, each one with its own information...
    and I need a menu to access them, where the links hovering change 1 image (showing an image if the hovered document/link)...

    any idea how to achieve this hover->image changes thing?


    best regards, and sorry for the bad english smiley
    luciano
      • 17705
      • 501 Posts
      can wayfinder handle TV from documents?

        • 16183
        • 1,390 Posts
        Quote from: luuuciano at Sep 08, 2009, 02:04 PM

        I have several documents, each one with its own information...
        and I need a menu to access them, where the links hovering change 1 image (showing an image if the hovered document/link)...

        any idea how to achieve this hover->image changes thing?


        best regards, and sorry for the bad english smiley
        luciano


        Image change is basically a CSS issue. You can either use different images for each menu link for normal and on hover states (not recommended these days) or you can use a CSS sprite - basically one big single image for the whole menu (google’s your friend here). If you want to see an implementation of this in Wayfinder, have a look at page 130 of the e-book referenced in my signature.

        Here’s an example code using CSS sprites:
        li#nav2 a { background:url(images/sprite-image.png) no-repeat -113px 0;}
        li#nav2.active a{background-position: -113px -246px;}
        li#nav2 a:hover {background-position: -113px -123px;}
        


        You can also search the forums for more info...

        cheers/k
          • 16183
          • 1,390 Posts
          Quote from: luuuciano at Sep 08, 2009, 03:36 PM

          can wayfinder handle TV from documents?

          Yes. You can. Just reference the TV using the following syntax [+TV_name+]. For instance
          [+myTV+]. See pages 98 and 112 in the e-book in my sig. You can also search the MODx Wayfinder forum

          cheers/k
            • 17705
            • 501 Posts
            kongondo, but I do not need a menu, that changes images...

            I need to show ithe images in other place of the page... all the images in the same place...

            for example the links menu at left, and up right a 100x100 spot where to shoe images...
              • 16183
              • 1,390 Posts
              Aah, I get you now...sorry for the confusion smiley. This would be like a tool tip thing. There are different solutions for this - javascript or CSS. A few examples:

              http://jlhaslip.trap17.com/samples/tooltips/index.html
              http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
              http://www.dynamicdrive.com/dynamicindex15/index.html

              You can then position the image exactly where you want it with CSS

              Is that what you are looking for? Maybe pick a solution first then we can see how to implement that in MODx. Or maybe there are solutions already here in the forums...

              cheers/k


                • 17705
                • 501 Posts
                kongondo, I need something like this:
                http://www.javascriptkit.com/script/script2/rolldifferent.shtml

                no idea how to make it... image src can be a TV, but not in the "current" document, an index showing the wayfinder links... it will be a TV in each document...

                mmm, any idea?
                  • 16183
                  • 1,390 Posts
                  Hi,

                  Sorry for the late response. Been very busy and will be for the next couple of weeks smiley

                  Here’s how I did it....

                  1. I created a container document for my menu items. You don’t need to do this. I just did this for organizational purposes on my test site smiley

                  2. I created a simple MODx template with two divs side by side. The div on the left contains my vertical menu. The div on the right is for the "planes"

                  3. I added the javascript to the <head> section of my MODx template as instructed by the author of the script. I changed the path to the images to suit my site like so:

                  preloadimages("assets/templates/tests/images/plane1.gif",
                  "assets/templates/tests/images/plane2.gif",
                  "assets/templates/tests/images/plane3.gif",
                  "assets/templates/tests/images/plane4.gif",
                  "assets/templates/tests/images/plane5.gif")


                  I obviously made sure that I had these images in that location wink

                  4. In the MODx template, in the right div, I put the path to the initial rollover image

                  <a href="javascript:warp()"><img src="assets/templates/tests/images/plane0.gif" name="targetimage" border=0></a>


                  5. I created a TV of type "number" and assigned it to the template used by my container document. I named this TV "slidenumber"

                  6. Under the above container document (in point 1) I created 5 documents for my test; plane 1.....plane 5. These sub-docs were assigned the same template as their parent doc. Using the TV slidenumber, I assigned each of the sub-docs a number for the variable myimages[] as instructed by the script author. Plane 1 was assigned 0, plane 2 -> 3, etc. I realise using TVs is not very dynamic, but there’s probably another way of doing this.

                  5. I created an outerTpl which I named "outerTpl.OnMouseover.Slideshow" and as its content pasted the following code:
                  <ul>[+wf.wrapper+]</ul>


                  Of course you can give the chunk a name of your choice

                  6. I created a rowTpl named "rowTpl.OnMouseover.Slideshow" with the following contents:
                  <li><a href="[+wf.link+]" onMouseover="changeimage(myimages[[+slidenumber+]],this.href)">[+wf.linktext+]</a></li>


                  Note how the TV slidenumber is referenced. You probably know this already; in WF, you specify a tv with the syntax [+nameOfYourTv+] hence => [+slidenumber+]

                  7. The Wayfinder call
                  [[Wayfinder? &startId=`76` &outerTpl=`outerTpl.OnMouseover.Slideshow` &rowTpl=`rowTpl.OnMouseover.Slideshow`]]


                  And here’s my MODx template code:

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head>
                  <title>[(site_name)] | [*pagetitle*]</title>
                  <meta http-equiv="Content-Type" content="text/html; charset=[(modx_charset)]" />
                  <base href="[(site_url)]"></base>
                  <link rel="stylesheet" href="assets/templates/tests/css/screen.css" type="text/css" media="screen, projection">
                  <link rel="stylesheet" href="assets/templates/tests/css/print.css" type="text/css" media="print"> 
                  <!--[if IE]>
                      <link rel="stylesheet" href="assets/templates/tests/css/ie.css" type="text/css" media="screen, projection">
                  <![endif]-->
                  <link rel="stylesheet" href="assets/templates/tests/css/style.css" type="text/css" media="screen">
                  <script type="text/javascript" src="assets/js/jquery-1.3.2.min.js"></script>
                  <script>
                  
                  /*Rollover effect on different image script-
                  By JavaScript Kit (http://javascriptkit.com)
                  Over 200+ free scripts here!
                  */
                  
                  function changeimage(towhat,url){
                  if (document.images){
                  document.images.targetimage.src=towhat.src
                  gotolink=url
                  }
                  }
                  function warp(){
                  window.location=gotolink
                  }
                  
                  </script>
                  <script language="JavaScript1.1">
                  var myimages=new Array()
                  var gotolink="#"
                  
                  function preloadimages(){
                  for (i=0;i<preloadimages.arguments.length;i++){
                  myimages[i]=new Image()
                  myimages[i].src=preloadimages.arguments[i]
                  }
                  }
                  
                  
                  preloadimages("assets/templates/tests/images/plane1.gif",
                  "assets/templates/tests/images/plane2.gif",
                  "assets/templates/tests/images/plane3.gif",
                  "assets/templates/tests/images/plane4.gif",
                  "assets/templates/tests/images/plane5.gif")
                  </script>
                  
                  </head>
                  <body>
                  <div id="wrapper" class="container">
                  <div class="span-24 last"><h1 id="branding">OnMouseover Slideshow Test</h1></div>
                  <div id="navigation" class="append-1 span-11">
                  [[Wayfinder? &startId=`76` &outerTpl=`outerTpl.OnMouseover.Slideshow` &rowTpl=`rowTpl.OnMouseover.Slideshow`]]
                  </div>
                  <div  class="append-1 span-10 prepend-1 last">
                  <h2>OnMouseover Slideshow</h2>
                  <a href="javascript:warp()"><img src="assets/templates/tests/images/plane0.gif" name="targetimage" border=0></a>
                  </div>
                  
                  </div><!-- end wrapper -->
                  </body>
                  </html>

                  And here’s the source of the menu that WF outputs

                  <ul>
                  <li><a href="/index.php?id=77" onMouseover="changeimage(myimages[0],this.href)">Plane 1</a></li>
                  <li><a href="/index.php?id=78" onMouseover="changeimage(myimages[1],this.href)">Plane 2</a></li>
                  <li><a href="/index.php?id=79" onMouseover="changeimage(myimages[2],this.href)">Plane 3</a></li>
                  <li><a href="/index.php?id=80" onMouseover="changeimage(myimages[3],this.href)">Plane 4</a></li>
                  <li><a href="/index.php?id=81" onMouseover="changeimage(myimages[4],this.href)">Plane 5</a></li>
                  </ul>



                  That’s it really. One thing that doesn’t work; clicking on the images doesn’t take you anywhere except load the initial image. I know nothing about js so can’t fix that, sorry.

                  See attached screens smiley

                  Hope this helps grin

                  cheers/k
                    • 17705
                    • 501 Posts
                    ohhh, yep
                    but the idea is that the amount of items in menu (documents in fact) increases...and/or at least varies...

                    maybe you have 4 now... 7 tomorrow, 10 next month, and so on....

                    all the other sections will work with a changing amount of items... but not the preload

                    I was thinking about adding the preload in the wayfinder section too... but I have no idea about how to add new items to an array...

                    mmm

                      • 16183
                      • 1,390 Posts
                      Quote from: luuuciano at Sep 16, 2009, 08:24 PM

                      ohhh, yep
                      but the idea is that the amount of items in menu (documents in fact) increases...and/or at least varies...

                      maybe you have 4 now... 7 tomorrow, 10 next month, and so on....

                      all the other sections will work with a changing amount of items... but not the preload

                      I was thinking about adding the preload in the wayfinder section too... but I have no idea about how to add new items to an array...

                      mmm

                      Hmmm, good point. That would make it truly dynamic. There’s probably different ways of doing that including using a snippet, a chunk, etc...So basically, whenever you add a new document an image path should be added to the preloadimage array..I will have to think about this. Hopefully someone else will chip in grin

                      cheers/k