[jQuery] Re: Having troubles accessing a variable in $.each

2008-10-24 Thread Ruby

I figured out my problem was that I stuck

// This
function picks up the click and opens the corresponding
info window
 
function myclick(i) {
 
GEvent.trigger(marker[i], click);
  }

in the wrong part of the script.


[jQuery] Having troubles accessing a variable in $.each

2008-10-23 Thread Ruby

I am having troubles with my google maps conversion to jquery. My
markers are being generated from a get json request and then each
marker is being created using $.each. My trouble happen when creating
a side bar with buttons to open the info windows. I can create the
button but can not seem to pull the individual marker info to activate
the info window. Here is my code so far:

var map;
$(document).ready(function() {
if (GBrowserIsCompatible()) {
// Initialize the map.
var baseIcon = new GIcon();
baseIcon.image = 
http://redhattester.googlepages.com/
GmapIcon02.png;
baseIcon.shadow = 
http://redhattester.googlepages.com/
GmapIcon02Shadow.png;
baseIcon.iconSize = new GSize(45, 45);
baseIcon.shadowSize = new GSize(42, 45);
baseIcon.iconAnchor = new GPoint(18, 
38);
baseIcon.infoWindowAnchor = new 
GPoint(19, 2);

map = new 
GMap2(document.getElementById(map)); // This sets up
the and rest just sets up the controls

map.addMapType(G_SATELLITE_3D_MAP); // For Google Earth
map.addMapType(G_PHYSICAL_MAP); 
// Adds Satelite maps
map.addControl(new 
GMenuMapTypeControl()); // This makes the
choses a drop down menu
map.addControl(new 
GLargeMapControl()); // Use large map
controls
map.setMapType(G_HYBRID_TYPE); 
// Hybrid map
map.enableScrollWheelZoom(); // 
Allows for users to scroll zoom
with their mouse wheel

//console.log(Loading the JSON file)

$.getJSON(GmapData.json,function(data){
   var NewLat = 
data.items[0].lat; var NewLng =
data.items[0].long; var NewPoint = new GLatLng(NewLat, NewLng);
   map.setCenter(NewPoint, 12);

$.each(data.items,function(i,item){
 var lat = item.lat; 
var lng = item.long; var name = item.name;
var chapter = item.chapter; var locale = item.locale; var imageSm =
item.ImageSm; var imageBg = item.ImageBg; var ContentSm =
item.ContentSm; // Sets up the sorted out info from the json file
 var NormalContent = 
'h3'+ name +'/h3div
class=iwstyle01img src=' + imageSm + '
class=MiniPicpstrong class=ChapterName' + chapter + '/
strong -  ' + locale + ' ' + ContentSm + '/pp
class=miniInstrucClick the + symbol at the top of this bubble to
see the image bigger./p/div';
 var BiggieContent = 
'div style=padding:10px 0 0 0;img
src=' + imageBg + ' class=BigPicpstrong class=ChapterName'
+ chapter + '/strong -  ' + locale + ' ' + ContentSm + '/p/div';

 var point = new 
GLatLng(lat,lng);
 var marker = new 
GMarker(point,{icon:baseIcon}); // Create the
marker.

GEvent.addListener(marker, click, function() {

marker.openInfoWindowHtml(NormalContent, {maxContent:
BiggieContent, maxTitle: name});
});

  
map.addOverlay(marker);

if (i==0) { // 
This will trigger open the newest story

GEvent.trigger(marker, click);
}


$('#side_bar').append('lia href=javascript:myclick('+ i
+')' + name + '/a/li');

});

});

// This function picks 
up the click and opens the corresponding
info window
  function 
myclick(i) {

GEvent.trigger(marker[i], click);
  

[jQuery] Shadowbox and AJAX

2008-09-22 Thread Ruby

I am trying to make a page that is using the ajax call on an XML file.
The trouble I am having is trying to get shadowbox to work. I need
some help please.

Here is the code so far

script type=text/javascript
!--
var $j = jQuery.noConflict();


$j(document).ready(function(){

$j.ajax({
type: GET,
url: Events.xml,
dataType: xml,
success: function(xml) {

$j(xml).find('event').each(function(){
var EventTitle = 
$j(this).find('title').text();
var StartDate = 
$j(this).find('start').text();
var EndDate = 
$j(this).find('end').text();
var EventDesc = 
$j(this).find('description').text();
var url = 
$j(this).find('url').text();
var trigger = 
$j(this).find('trigger').text();

if (url != ' ') {
$j('div 
class=StoreEvent/div').html('div
class=StoreEventTitle'+EventTitle+'/div'+EventDesc+'a href='+url
+' rel=shadowbox class=EventLink'+trigger+'/
a').appendTo('.StoreEventGeneric');

} else {
$j('div 
class=StoreEvent/div').html('div
class=StoreEventTitle'+EventTitle+'/div'+EventDesc+'
').appendTo('.StoreEventGeneric');
}

});
}
});

});

--
/script