We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23491 ☆ A M B ☆
    • 1,056 Posts
    What version of mooTools were you seeing the conflict with?
      Mike Reid - www.pixelchutes.com
      MODx Ambassador / Contributor
      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
      ________________________________
      Where every pixel matters.
      • 15888
      • 7 Posts
      mootools v1.1

      Anything I stuck in the following wasn’t getting executed

      <head>
      window.addEvent(’load’,function(){
      doSomething();
      });
      </head>
        • 8883
        • 59 Posts
        Hi,
        is it possible to add the function map.enableScrollWheelZoom(); for scrolling with mousewheel but without scrolling the page?
        There: http://esa.ilmari.googlepages.com/scrollzoom.htm is a workaround but I failed to build this in.
          • 8883
          • 59 Posts
          No ideas?
            • 29774
            • 386 Posts
            Bit late, sorry!

            Add this below line 113:
            map.enableScrollWheelZoom();
            


            Now add this at the bottom of the javascript (around line 160, just before  //]]></script>):
            // Prevent page scroll
            function wheelevent(e) {
            	if (!e){
            		e = window.event;
            	}
            	if (e.preventDefault){
            		e.preventDefault();
            	}
            	e.returnValue = false;
            }
            var map = document.getElementById("'.$mapid.'");
            GEvent.addDomListener(map.getContainer(), "DOMMouseScroll", wheelevent);
            map.getContainer().onmousewheel = wheelevent; 
            


            Let me know if it works.
              Snippets: GoogleMap | FileDetails | Related Plugin: SSL
              • 8883
              • 59 Posts
              Hi,
              Zooming with wheel works, but not without scrolling the page.
              The Code:

              <?php
              /*
                 Snippet Name: GoogleMap
                 Short Desc: Outputs a Google map for a given postcode
                 Created By: Mark Croxton ([email protected])
                 Modifed to allow lat/lng passing, added large control option and bubbletpl option by Andrew Ayre
                 Last modified: 01/29/2007
                 Version: 1.2
                 Google Map API Version: 2.0
              
                 Example call:
                 [!GoogleMap?key=`ABQIAAAA...` &zip=`bn14fb` &title=`My Office` &address=`101 My Road, My town, My Country` &width=`300` &height=`300`!]
                 [!GoogleMap?key=`ABQIAAAA...` &lat=`53.5632` &lng=`45.655` &title=`My Office` &address=`101 My Road, My town, My Country` &width=`300` &height=`300`!]
              
                 Params:
                  &key  = Google API Key (string - required) - see http://www.google.com/apis/maps/
                  &zip  = UK or US postal code (string) (overrides lat/lng)
                  &lat   = latitude (float)
                  &lng  = longitude (float)
                  &title  = Map title - used in the pop-up bubble (string)
                 	&address  = Full address - used in the pop-up bubble (string)
                 	&width  = Map width (integer)
                 	&height = Map height (integer)
              	&zoom = Map zoom level (integer)
              	&mapid = Map div css id (string)
              	&bubblewidth = pop-up bubble width (integer)
              	$phmode  = output to placeholders? (recommended) (boolean)
                 		[+gmapjs+] place in the head of your template file
                 		[+gmap+] place where you want the map to appear
                      $largecntrl = set to 1 for large map control (boolean)
                      $bubbletpl = name of chunk to use inside bubble (string) (overrides title and address)
              */
              
              $key = isset($key)? "$key" : '';
              $zip = isset($zip)? "$zip" : '';
              $lat = isset($lat)? "$lat" : '';
              $lng = isset($lng)? "$lng" : '';
              $title = isset($title)? "$title" : '';
              $address = isset($address)? "$address" : '';
              $width = isset($width)? "$width" : '400';
              $height = isset($height)? "$height" : '400';
              $zoom = isset($zoom)? "$zoom" : '15';
              $mapid = isset($mapid)? "$mapid" : 'map';
              $bubblewidth = isset($bubblewidth)? "$bubblewidth" : '230';
              $phmode = (!isset($phmode)) ? false : ($phmode==true);
              $largecntrl = isset($largecntrl)? "$largecntrl" : '0';
              $bubbletpl = isset($bubbletpl)? "$bubbletpl" : '';
              
              # geocode the postcode
              if (strlen($zip)) {
                $coord = geocode($zip); // coord[0]=lng and coord[1]=lat
              }
              else
              {
                $coord[0] = $lng;
                $coord[1] = $lat;
              }
              
              $gmapjs = '
              
              <script src="http://maps.google.com/maps?file=api&v=2&key='.$key.'" type="text/javascript"></script>
              <script type="text/javascript">
              //<![CDATA[
              
              function GloadMap() {
                  if (GBrowserIsCompatible()) {
                  var map = new GMap2(document.getElementById("'.$mapid.'"));
                  map.setCenter(new GLatLng('.$coord[1].','.$coord[0].'),'.$zoom.');
              ';             
              
              if ($largecntrl == 1) {
                  $gmapjs .= 'map.addControl(new GLargeMapControl());';
              }
              else {
                  $gmapjs .= 'map.addControl(new GSmallMapControl());';
              }
              
              $gmapjs .= '
                  map.addControl(new GMapTypeControl());
                  map.addControl(new GOverviewMapControl());
                  map.enableScrollWheelZoom();
                  
                  // Create our "tiny" marker icon
                  var icon = new GIcon();
                  icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
                  icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
                  icon.iconSize = new GSize(12, 20);
                  icon.shadowSize = new GSize(22, 20);
                  icon.iconAnchor = new GPoint(6, 20);
                  icon.infoWindowAnchor = new GPoint(5, 1);
              
                  // Creates one of our tiny markers at the given point
                  function createMarker(point, index) {
                    var marker = new GMarker(point, icon);';
              
              if (strlen($bubbletpl)) {
                    $gmapjs .= 'var myMarkerContent = "'.$modx->getChunk($bubbletpl).'";';
              }
              else {
                    $gmapjs .= 'var myMarkerContent = "<div style=\"width:'.$bubblewidth.'px; overflow:auto;\"><h4>'.$title.'</h4><p>'.$address.'</p></div>";';
              }
              
              $gmapjs .= '
                    map.addOverlay(marker);
                    GEvent.addListener(marker, "click", function() {
                      marker.openInfoWindowHtml(myMarkerContent);
                    });
                  }
                  createMarker(new GPoint('.$coord[0].','.$coord[1].'));
              	}
              }
              //initialise Google map
              window.addEvent(\'load\',GloadMap);
              window.addEvent(\'unload\',GUnload);
              // Prevent page scroll
              function wheelevent(e) {
              	if (!e){
              		e = window.event;
              	}
              	if (e.preventDefault){
              		e.preventDefault();
              	}
              	e.returnValue = false;
              }
              var map = document.getElementById("'.$mapid.'");
              GEvent.addDomListener(map.getContainer(), "DOMMouseScroll", wheelevent);
              map.getContainer().onmousewheel = wheelevent;
              //]]>
              </script>
              ';
              
              $gmap ='<div id="'.$mapid.'" style="width: '.$width.'px; height: '.$height.'px">
              <noscript>
              <center>
               <img src="http://maps.google.com/mapdata?Point=b&Point.latitude_e6=[*breitengrad:math=`?*1000000`*]&Point.longitude_e6=[*laengengrad:math=`?*1000000`*]&Point.iconid=15&Point=e&latitude_e6=[*breitengrad:math=`?*1000000`*]&longitude_e6=[*laengengrad:math=`?*1000000`*]&zm=4800&w=490&h=265&cc=&min_priority=1">
              <span style="font-size:0.8em;clear:left;float:none;"><br></br>
              <a href="http://maps.google.com/maps?f=q&output=html&q=[*breitengrad*]+[*laengengrad*]&zoom=0&zp=OOOOOOOOOIIIIII" target="_blank">GoogleMaps - Karte: [*google_maps_beschreibung*]</a>
              </span>
              </center>
              </noscript>
              </div>';
              
              # put the js in the <head>
              #$modx->regClientStartupScript($gmapjs, true); // note: this is broken in 0.91, so we can't use just yet
              
              if ($phmode) {
              	# output to placeholders
              	$modx->setPlaceholder('gmapjs', $gmapjs);
              	$modx->setPlaceholder('gmap', $gmap);
              	return;
              } else {
              	$output = $gmapjs."\n".$gmap;
              	return $output;
              }
              
              /* ---------------------------------------------------
                 Functions
                 --------------------------------------------------- */
              function geocode($postcode) {	
              	$postcode = urlencode($postcode);
              	$coord = array();	
              	// The URL of google to append the postcode
                  $url = "http://maps.google.com/maps?output=kml&q=";
              	$haystack = file_get_contents($url.$postcode);
              	$start = strpos($haystack, '<coordinates>') + 13;
              	$end = strpos($haystack, '</coordinates>');
              	$coords = substr($haystack, $start, ($end-$start));
              	$coord = explode(",", $coords);	
              	return $coord;
              }
              ?>


              I changed something, because troubles with slimbox/maxigallery and because I’m using TVs.
                • 11975
                • 2,542 Posts
                Hi,

                just for information, I’m currently working on a snippet which allows to define the marker on the map by drag and drop.
                You can search for an adress (if found the marker is created)
                Drag and drop the map (if no marker exists you canb add one at the center Map)
                Drag and drop the marker.

                The whole settings will be saved in a tv.

                At the moment the save feature is not yet finished but you can see how it works
                here => http://www.dixsix.fr/explorer/index.php?id=407

                :-)

                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 4749
                  • 623 Posts
                  Very cool! I can’t wait to see the results.
                    The MODx has you...
                    Utah Web Design
                    • 11975
                    • 2,542 Posts
                    Quote from: heliotrope at Oct 08, 2007, 07:08 AM

                    Hi,

                    just for information, I’m currently working on a snippet which allows to define the marker on the map by drag and drop.

                    Updated demo.

                    here => http://www.dixsix.fr/explorer/index.php?id=407
                    Will post the code asap.

                    :-)
                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 5324
                      • 16 Posts
                      Is there anyway for the bubble to be turned off so it does not show? Thanks.