We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I like MaxyGalley a lot and use it a lot also. now I got a question: would it be posible to open the images in a div that is part of the page? instead of popups or opening new pages?

    what I mean is a bit like this (could be done with js i think css would be a pain)

    no need for the hover ffect ider just on cklik that it opens in another div.

    or maybe if the above is not posible would it be posible to set a target using the external embedded settings to place the image in an Iframe.


    Thank you for making MaxiGallery

    Dimmy

      follow me on twitter: @dimmy01
      • 7923
      • 4,213 Posts
      Easiest way in the current version I guess would be to have the div somewhere on the page, initially hidden for example, or with a default image "placeholder" as background. Set the background not to be repeated.

      Then in maxigallery, use the display=`embedded` and embedtype=`popup` and then modify the popup.js in the js folder to change the selected picture to the background of the div e.g. :

      Have a div something like:

      <div id="picHolder" style="background-image:url(placeholder.jpg); background-repeat:no-repeat; height:400; width:400"></div>


      Modify the popup.js to contain:

      function openWindow(url, title, height, width, name, parms) {
      	var picHolder = document.getElementById('picHolder');
      	picHolder.style.backgroundImage="url("+url+")";
      }


      and you could use the height and width parameters to set the size of the div and have title to appear somewhere etc.. In the trunk version though there is a template ability in MaxiGallery so this could be done within the template..


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 6726
        • 7,075 Posts
        Nice tip Doze, thanks smiley !
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 7455
          • 2,204 Posts
          Thanks Doze this works great, could this be in the next release?

          I realy like this Snippet!
            follow me on twitter: @dimmy01
            • 7923
            • 4,213 Posts
            Yes, in the next version with templating, it will be very easy to do..


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 7455
              • 2,204 Posts
              The javascript fix/mod you made for viewing in another div does work on FF but not in IE.

              but you sayd that this could also be done using templates?
              could you explane how this would work?

              Thanks Dimmy
                follow me on twitter: @dimmy01
                • 7923
                • 4,213 Posts
                Quote from: Dimmy at Aug 21, 2006, 03:12 PM

                The javascript fix/mod you made for viewing in another div does work on FF but not in IE.
                I tried it in IE6 and in FF, both works ok. Do you have a link for me to check? You can send via PM if you want.

                Quote from: Dimmy at Aug 21, 2006, 03:12 PM

                but you sayd that this could also be done using templates?
                could you explane how this would work?
                It’s not possible in this version yet, but in the upcoming release. But basicly I mean that by having a template, you can make links, images, etc have whatever events you want to call javascript functions with your own parameters without touching the snippet code.. like have the gallery overview be formed like this:
                <div>
                	<a href="javascript:void(0);" onMouseOver="javascript:showPic('[{pic.[{c1.val}].makeUrl}]')" onMouseOut="javascript:removePic()">
                		<img src="[{pic.[{c1.val}].val}].tn_file}]" class="thumbnail" title="[{pic.[{c1.val}].pictitle}]" alt="[{pic.[{c1.val}].pictitle}]" />
                	</a>
                </div>
                




                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 7923
                  • 4,213 Posts
                  OK, it seems that IE doesn’t like the javascript:void(0); being in the href attribute of the link, so do the following:

                  Edit snippet code and replace (line 824):

                  $link="<a href=\"javascript:void(0);\" onClick=\"javascript:openWindow('[(site_url)]".$file."','".htmlentities(stripslashes($pic['title']),ENT_QUOTES,$mgconfig['use_charset'])."',".$window_height.",".$window_width.",'gallery');\">";
                  


                  with:

                  $link="<a href=\"#\" onClick=\"javascript:openWindow('[(site_url)]".$file."','".htmlentities(stripslashes($pic['title']),ENT_QUOTES,$mgconfig['use_charset'])."',".$window_height.",".$window_width.",'gallery');\">";
                  


                  The downside of this is that when # is used as the link url, some browsers allways scroll to the top of the page. I was using the javascript:void(0) to go around this in the popup script, what works in IE6 too, but not the background changing.. Weird. And to be even more weirder, if you put alert() to the last line of your modified popup.js function, the backgrounds will change in IE too.

                  Anyone encountered this before or know some way to "force" the image/element repaint in IE via javascript?

                  If you want to have the images to change on mouse hover, change the line to:

                  $link="<a href=\"javascript:void(0);\" onMouseOver=\"javascript:openWindow('[(site_url)]".$file."','".htmlentities(stripslashes($pic['title']),ENT_QUOTES,$mgconfig['use_charset'])."',".$window_height.",".$window_width.",'gallery');\">";
                  


                  And if you want to pass the picture description to the js function too (to then place somewhere on the page via innerHtml, use:

                  $link="<a href=\"javascript:void(0);\" onMouseOver=\"javascript:openWindow('[(site_url)]".$file."','".htmlentities(stripslashes($pic['title']),ENT_QUOTES,$mgconfig['use_charset'])."','".htmlentities(stripslashes($pic['descr']),ENT_QUOTES,$mgconfig['use_charset'])."',".$window_height.",".$window_width.",'gallery');\">";
                  


                  And change the popup.js to:

                  function openWindow(url, title, descr, height, width, name, parms) {
                  	var picHolder = document.getElementById('picHolder');
                  	picHolder.style.backgroundImage="url("+url+")";
                  }
                  


                  To have the picture title and description showing up somewhere via js, you could do a divs for them first like:

                  <div id="picTitle"></div>
                  <div id="picDescr"></div>
                  


                  Then add following javascript to the popup.js function:

                  var picTitle = document.getElementById('picTitle');
                  picTitle.innerHTML = title;
                  var picDescr = document.getElementById('picDescr');
                  picDescr.innerHTML = descr;
                  


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 7455
                    • 2,204 Posts
                    Thanks again it works great, maybe in the next version a posiblity to set this as onClick or onHover in the settings when embedded.

                    and I added a line so that the alt atribute for the thubs hold the description instead of the title
                      follow me on twitter: @dimmy01