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

    this is a microsite to support an advertising campaign for Davroc, the UK’s largest bathroom fittings distributer. Its makes extensive use of jQuery, including ajax form validation tied together with a custom snippet via json. Ditto made it super easy to set up the gallery and store listings with tagging. I used a jquery-ized version of my GoogleMaps snippet for the maps, and I hope to release an update shortly (it will use the Mapstraction api, so you can plug in other mapping services like Yahoo or Multimap - if I can fix some bugs that is...).

    http://interiors.davroc.co.uk/

    Anyway, I’d love your feedback and suggestions!

    Mark
      Snippets: GoogleMap | FileDetails | Related Plugin: SSL
      • 34000
      • 77 Posts
      Are you using jquery then to fade in the colorized images on hover, love that!
      At first I thought that had to be flash, is there a plugin in use on the hovers then?
      I remember other modX sites with similar subject matter, did you have a previous site for this company then.
      Looks just luxurious design-wise.
        MODx Revo 2.1 and done!
        • 29774
        • 386 Posts
        I’m using jquery to add the fadeTo() behaviour to a <span> on the mouseover and mouseout events. The css applies the same background image to the anchor and the span (the image consists of a black and white half, and a colour half, and in the <span> the bg position is shifted to the left) - so that the colour version of the image doesn’t need to be preloaded. See /_assets/js/home.js

        You may be thinking of my Aquavision site http://www.aquavision.co.uk/, its for the same company.
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
          • 34000
          • 77 Posts
          Right right, a css sliding doors technique then using jQuery.
          I’m from the plug and play school of JQuery, not sure I could code it on my own, looking at your example online maybe I could then.
          thanks for sharing.
          That was the site www.aquavision.co.uk/, I always like that one, I couldn’t understand why anyone wouldn’t.
          You’ve outdone yourself then.

          Thought I would peek at the images http://interiors.davroc.co.uk/_assets/img/home/home_dream.jpg
          What are these images then just text mouseovers maybe?
          http://interiors.davroc.co.uk/_assets/img/nav_dream.png
          thanks for the lesson what’s a rebe chip anyways, lol.

          I’ve done my sliding doors this way before, should maybe be adaptable then.
          These were for vertical menu list items
          ---------------------
          #nav a {
          display: block;
          width: 100px;
          margin: 0;
          padding: 0;
          height: 36px;
          text-decoration: none;
          text-indent: -900000px;
          outline:none;
          }

          #nav #home01 a {
          background: url(myPic_08bttns_01.gif) no-repeat 0 0;
          }

          #nav #home01 a:hover {
          background-position: -100px 0;
          }

          #nav #about02 a {
          background: url(myPic_08bttns_02.gif) no-repeat 0 0;
          }

          #nav #about02 a:hover {
          background-position: -100px 0;
          }
          etc...
          --------------------------
          Seems like I’ve hardly used spans, not that they are a bad thing.
          I see yours is using H3 tags, which maybe does make more sense for the structure.
          thanks again for the lesson.
            MODx Revo 2.1 and done!
            • 7231
            • 4,205 Posts
            Sweet!! Another excellent site from therebechips grin The effects are great, not over done, just enough to keep it interesting. And the request for brochure effect blew me away. Very nice color combinations. Well there is nothing but good stuff to say.

            Great job.

            I really need to get up-to-date with javascript enhancements.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 23299
              • 1,161 Posts
              Very nice!

              Can you go into detail a little more about how you set up the gallery?

              For instance the http://interiors.davroc.co.uk/dream/ page: how did you create the thumbnails and the landing space for the full size images to open into?

              How much is CSS, how much is MODx snippets and how much is scripts etc?

              Thanks!
                • 34000
                • 77 Posts
                If you go into the script list you can pick apart alot of what the javascript is doing.
                It can all be inter-related sometimes, certain bits of CSS keeping the images aligned and spaced, javascript creating fades and timed or alpha events. This would be my guess as to the gallery script functionality:
                http://interiors.davroc.co.uk/_assets/js/gallery.js
                There can be bits of script in the head tags too.
                This one’s quite a study.

                I’m pretty rusty on the modX control panel.
                  MODx Revo 2.1 and done!
                  • 7231
                  • 4,205 Posts
                  Based on the previous discussions this is mostly (if not all) hand codded, I don’t think much comes out of the repository. therebechips’s work is very inspirational.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 33337
                    • 3,975 Posts
                    Just plain beautiful site! smiley
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link
                      • 29774
                      • 386 Posts

                      Can you go into detail a little more about how you set up the gallery?

                      Sure.

                      Markup
                      The screen shot here should explain how the I’ve represented each image as a document in the site tree:

                      I’m using Ditto to output the thumbs markup like this:
                      <ul id="thumbs">
                      <li><a href="image.jpg" title="Tap 54365"><em></em><img src="assets/images/dream/thumb/dream_tap_54365.jpg" alt="Tap 54365" width="34" height="34" /></a></li>
                      </ul>	
                      


                      I’m using Ditto with the parameter save=`2` so that the result set is saved for later.

                      The big image #bigImg and #loading div look like this:
                      <div id="loading"></div>
                      <img src="myimage.jpg" alt="myimagetitle" id="bigImg" />
                      

                      The default big image is the first image found in the Ditto result set. I’m using a little snippet to output it, like this:
                      # grab the saved ditto resource of images
                      $aImg  = $modx->getPlaceholder("ditto_resource");
                      // get the first image in the array
                      return '<img src="'.$aImg[0]["imgBig"].'" alt="'.$aImg[0]["pagetitle"].'" width="430" height="407" id="bigImg" />';
                      


                      CSS
                      This is the fun bit. You can make the thumbs look however you like. I have chosen to have them as a square grid, and to use a transparent png for the hover and active states. The key thing to understand is that I’m using absolute positioning inside a relatively positioned element, and shifting the left position on mouseover, or when the parent element has the class ’active’. This technique allows for *transparent* png rollovers in IE6. My css looks like this:
                      #thumbs li {
                      	display: inline;
                      }
                      #thumbs a  {
                      	display: block;
                      	position:relative;
                      	float: left;
                      	margin: 0 10px 10px 0;
                      	text-decoration: none;
                      	width: 34px;
                      	height: 34px;
                      	overflow: hidden;
                      }
                      #thumbs a em {
                      	display: block;
                      	width: 68px;
                      	height: 34px;
                      	position:absolute;
                      	left:0; top:0;
                      	background: transparent url('/_assets/img/thumbs_overlay.png') 0 0 no-repeat;
                      }
                      
                      #thumbs a:focus em, #thumbs a:hover em, #thumbs a.active em {
                      	left: -34px;
                      	cursor: pointer;
                      }
                      / * IE6 transparency */
                      * html #thumbs a em {
                      	background-image: none;
                      	filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src='/_assets/img/thumbs_overlay.png',sizingMethod='scale');
                      }
                      
                      /* loading div is positioned over the top of the image */
                      #loading {
                      	position: absolute;
                      	top:0; left:185px;
                      	width: 430px;
                      	height: 407px;
                      	background: #C8CED3 url('/_assets/img/loading2.gif') 201px 189px no-repeat;
                      	display:none;
                      }
                      


                      Javascript

                      The js does the following:
                      * on dom ready it iterates through each of the thumbnail image links and adds a click behaviour
                      * on click of a thumbnail the loading div fades in to hide the big image and the ’active’ class is applied to the selected thumbnail.
                      * the selected image is loaded into a temporary image object and then swapped with the big image when the new image has loaded
                      * the loading div is now faded out and hidden, revealing the new image.

                      This class simply provides a container for each gallery image. I seperated it out like this so that other meta data about an image could be modeled by the object, but for this gallery I’m just using the image url and title:
                      var GalleryImage = function (image,title) {	
                      	
                      	// private vars
                      	var self = this; // get the scope of the instantiated object
                      		
                      	// public instance variables
                      	this.image = image; // array
                      	this.title = title; 
                      }
                      


                      This object attaches the behaviour to the thumbnail images and handles the on click event. Here I’m using jQuery to do the alpha fades, the selection of objects in the document, and to handle callbacks (which it is brilliant at). Previously I’d hand coded this but now I realise that it’s best to not reinvent the wheel and just let jQuery get on with it...
                      // Gallery object (literal notation)
                      var Gallery = {
                      	
                      	//default config
                      	imageId : '#bigImg',	
                      	loadId : '#loading',
                      	thumbs : '#thumbs > li > a', // selector for image thumb links
                      	CSSselectedClass : 'active', // css class to apply to selected items
                      	startImg : 0,
                      	startShowImg : true,
                      	aImages : new Array (),
                      		
                      	//private vars
                      	selectedImg : -1,
                      	isPaused : false,
                      	imgLinks : new Array (),
                      	loaded : false,
                      	
                      	showImg : function (img) {
                      		if (Gallery.loaded && !Gallery.isPaused && Gallery.selectedImg != img) {
                      			if (img !=-1) {
                      				Gallery.showImage(img);
                      				//manage links
                      				Gallery.manageLinks(img);
                      			}
                      		}
                      	},
                      	
                      	manageLinks : function (img) {
                      		//set css class on thumbnail images
                      		for (i=0; i<Gallery.imgLinks.length; i++) {
                      			if(i === img) { // set selected class
                      				Gallery.imgLinks[i].attr("class",Gallery.CSSselectedClass);
                      			} else { //remove class attribute
                      				Gallery.imgLinks[i].removeAttr("class");
                      			}
                      
                      		}
                      	},
                      	
                      	swapImage : function (img) {
                      		$bigImg =  $(Gallery.imageId);
                         		$bigImg.attr("src", Gallery.aImages[img].image);
                      		$bigImg.attr("alt", Gallery.aImages[img].title);
                      		$bigImg.attr("title", Gallery.aImages[img].title);
                      	},
                      
                      	showImage : function (img) {
                      
                      		// show loadmeter 
                      		$loading=$(Gallery.loadId);
                      		$loading.css({
                      			display: "block"
                      		});
                      		
                      		$loading.fadeTo(200,1, function() {
                      			// preload image into a temporary image object so that it is cached
                      			imgPreload = new Image();
                      			
                      			// onload
                      			imgPreload.onload=function(){
                      				Gallery.swapImage(img);
                      					
                      				//fade out loading
                      				// pass the killPause() function to be called back on completion
                      				Gallery.isPaused = true;
                      				Gallery.selectedImg = img;
                      				$loading.fadeTo("slow",0,Gallery.killPause);
                      			}	
                      			imgPreload.src = Gallery.aImages[img].image;
                      			
                      		});
                      	},
                      	
                      	killPause: function() {
                      		Gallery.isPaused = false;
                      	},
                      
                      	attachLinkBehavior : function () {	
                      		$(Gallery.thumbs).each(
                      			//lopp trough each item found
                      			function (i) {
                      				//build array of big images
                      				Gallery.aImages.push(new GalleryImage($(this).attr("href"),$(this).attr("title")));
                      				// build array of thumbs
                      				Gallery.imgLinks.push($(this));
                      				
                      				$(this).bind (
                      					"click",
                      					function(){
                      						// do stuff on click
                      						Gallery.showImg(i);
                      						return false; // stop link being followed
                      					}
                      				);
                      			}
                      		);
                      	},
                      	
                      	init : function () {
                      		// add link behaviour
                      		Gallery.attachLinkBehavior();
                      		Gallery.loaded=true;
                         		if (Gallery.startShowImg) {
                      			//show start image
                      			Gallery.showImg(Gallery.startImg);
                      		}
                      	}
                      }
                      


                      So that’s it really. I hope you can see that you adapt this for all sorts of galleries, since you can use modx document tvs to store any kind of data and then extend the GalleryImage class so that it is available to the Gallery object.


                        Snippets: GoogleMap | FileDetails | Related Plugin: SSL