jQueryHelp

Help with jQuery Mods and Hacks for your Ning Network!

I am attempting to add addmap.js to my site in, for example a forum topic, like this one which mentions a specific area of Florida. http://landsurveyorsunited.com/group/floridalandsurveyors/forum/top...


All content inside the forum post has a class of .xg_user_generated but with using addmap.js i have to wrap the content inside a DIV called 'content' in order to allow the code to read the text for location terms.  What I am trying to do is either add the class 'content' to .xg_user_generated if at all possible or wrap 'content' around the .xg_user_generated div

as it is my code looks like this:

<script src="http://github.com/codepo8/geotoys/raw/master/addmap.js"></script>
<script>
addmap.config.mapkey = 'ABQIAAAAaYvyH4mrY2VAxuatgfqGbBSrM36IpC_CQoTA5lex6_vgowypaxQkA54BVwzaRDivBKx0hg-7oijcXg';
addmap.analyse('content');
</script>
<script>
$(".xg_user_generated").addClass("content");
</script>



`


any ideas what I might be doing incorrectly?  thanks TJ

Justin Farrow | Land Surveyors United

Tags: addclass, content, forums, jquery, question, usergenerated

Views: 63

Reply to This

Replies to This Discussion

Looks like the addmap js is looking for an element with an ID of content rather than a CLASS of content.

If you View Source on that demo page you linked to, you'll see what I mean....

 

<div id="content">
<p>Currently I am on a working trip in Sunnyvale. I came via San Francisco and I need to go to San Jose later on to return the broken rental car. I'll probably check visit the Facebook guys in Palo Alto afterwards.</p>
</div>

 

So you couldreplace your line

$(".xg_user_generated").addClass("content");

with this, to wrap the inner content of the first div of class xg_user_generated on that page with a div of id='content' and then it may work.  Try

 

x$('.xg_user_generated:first').wrapInner('<div id="Map_Content" />');

 

Don't forget to use x$ rather than just $ if you are putting the code in your custom code box.  And don't use just "content" as the id because it is way too generic and might collide with an element with that id that Ning uses.  So in your line to call the addmap js, change to

addmap.analyse('Map_Content')

to match the more specific id you should use.

You can read more on on the jQuery function innerWrap here:

http://api.jquery.com/wrapInner/

Best wishes!

"TJ"

 

 

'TJ' is the Owner of jQueryHelp.
Please Visit http://YouTubeStars.com - Thanks!

thank you TJ you are the MAN....im gonna get this working and send you a donation..thanks for your help homeboy...this makes a lot of sense

Justin Farrow | Land Surveyors United

Thanks in advance for the donation, and I am glad I was able to help!

ePalmetto said:

thank you TJ you are the MAN....im gonna get this working and send you a donation..thanks for your help homeboy...this makes a lot of sense

Justin Farrow | Land Surveyors United
'TJ' is the Owner of jQueryHelp.
Please Visit http://YouTubeStars.com - Thanks!

still trying to wrap my mind around this.  here is what I am using currently but it still won't show...

<script src="http://github.com/codepo8/geotoys/raw/master/addmap.js"></script>
<script>
addmap.config.mapkey = 'ABQIAAAAaYvyH4mrY2VAxuatgfqGbBSrM36IpC_CQoTA5lex6_vgowypaxQkA54BVwzaRDivBKx0hg-7oijcXg';
addmap.analyse('Map_Content');
</script>
<script>
x$('.xg_user_generated:first').wrapInner('<div id="Map_Content" />');
</script>

racking my brain...any ideas?  i do appreciate your time TJ

TJ @ jQueryHelp said:

Thanks in advance for the donation, and I am glad I was able to help!

ePalmetto said:

thank you TJ you are the MAN....im gonna get this working and send you a donation..thanks for your help homeboy...this makes a lot of sense

Justin Farrow | Land Surveyors United
'TJ' is the Owner of jQueryHelp.
Please Visit http://YouTubeStars.com - Thanks!
Justin Farrow | Land Surveyors United

any new ideas TJ?

Justin Farrow | Land Surveyors United

Maybe the order has to be different, because we need to do the wrapping before we call the addmap code.

So try

 

<script type="text/javascript">
x$('.xg_user_generated:first').wrapInner('<div id="Map_Content" />');
</script>

<script type="text/javascript" src="http://github.com/codepo8/geotoys/raw/master/addmap.js"></script>

 

<script type="text/javascript">
addmap.config.mapkey = 'ABQIAAAAaYvyH4mrY2VAxuatgfqGbBSrM36IpC_CQoTA5lex6_vgowypaxQkA54BVwzaRDivBKx0hg-7oijcXg';
addmap.analyse('Map_Content');
</script>

Put that in your custom code box and see if it works.  Best wishes!

'TJ' is the Owner of jQueryHelp.
Please Visit http://YouTubeStars.com - Thanks!

ok...good news,   i got the map to at least show up...  look here on Nigeria Group and This Post...

however something isn't right with the selector i believe as i do not want it to show on group home page necessarily....  any chance i might be able to further specify....

also tell me your paypal info to make the donation this evening... thanks TJ

Justin Farrow | Land Surveyors United

I found the Nigeria group, is this it? http://landsurveyorsunited.com/group/nigeria-land-surveyors

What post, I don't see a link.

Yeah you can add more code so the code only works on certain pages and not others.

There's a Donation button on the Main page here, or just go to PayPal and click Send Money and enter my account email which is pay@bkserv.com

Thanks!

'TJ' is the Owner of jQueryHelp.
Please Visit http://YouTubeStars.com - Thanks!

Reply to Discussion

RSS

Notifications

Temporarily Offline

Friends of Friends

© 2013   Created by TJ @ jQueryHelp.

Badges  |  Report an Issue  |  Terms of Service

EOP
EOP2