Add Logo to Ning Bar - (collaborative efforts of Jen and Kris)

 

Kris of Bikerspost.com wrote tonight and asked how to add his logo to his NingBar. Kris is a Design Client, and a VIP Member of JenSocial. So, I was happy to share this code with him. Ironically I had already written the code for the new design for JenSocial - - coming soon! We discussed behind the scenes and decided we'd share with everyone.

 

Important Note: If you are using the tip for adding the SignIn Box links to your NingBar, this will not format correctly.

 

Instructions:

  • You will need to size your logo to no more than 30-60 pixels in height. Kris has sized his logo to: 300px width by 52px height.
  • Upload your image via a blog or File Manager.
  • Copy/paste the image URL.
  • Edit the code below, and add your image URL.
  • Edit the #xn_bar height to a few pixels more than the height of your logo. See code below within the <style> tag.
  • Add ALL of the code to your Custom Code Box via: My Network/Tools/Custom Code
  • You will probably need to tweak the padding. Kris added some extra padding to top, like this: <img style="float:left!important;padding-left:10px;padding-top:5px;">

 

<style>
#xn_bar {
 height:60px!important;
}
</style>

<script type="text/javascript">
if (typeof(x$) != 'undefined') {
x$("#xn_bar #xn_bar_menu").prepend('<img style="float:left!important;padding-left:10px;" src="yourimageurl">');
}
else {
}
</script>

 

Kris also needed the following CSS for his Ning Bar. This will vary per theme. If you use the CSS below, add to Advanced CSS.

#xn_bar {
margin: 0 auto;
width: 1002px !important;
}

 

Be sure to see the awesome tip Kris offered to add logo to your SignIn Box.

 

Have fun!

Jen and Kris

Tags: add logo to ningbar, logo, logo in ningbar, ning bar, ningbar

Views: 1529

Reply to This

Replies to This Discussion

OMG!!! What is this witchcraft?!!! Thanks so much Jen!!!! :D

Hey Jen sorry to bother you so much with this but how can I make the code above a hyperlink?

I had the same problem after I added a link to the logo in the top bar.

love it...thx all

Can someone help when i add the link to my code my logo is cut in half.

See Jen's response here.

This didn't work for me. Ugh! :(

May I suggest these changes?

<style>
#xn_bar {
  height: auto !important;
}
#xn_bar #ningbar_logo {
 float: left; /* although I don't think you will always need this - can probably use left: 0 with position relative or something */
 padding: 0 0 0 10px;
}

</style>

<script>
if (typeof(x$) != 'undefined') {
  x$("#xn_bar #xn_bar_menu").prepend('<img id="ningbar_logo" src="yourimageurl">');
}
</script>

If you say height: auto, it will stretch as big as you need it for the image, without having to edit it anytime you feel like updating the image. If you want more spacing, use something like padding: 0 0 10px 0; to put 10px at the bottom of it, no matter the height.

I also moved the styles for the logo outside of the javascript, because it is good practice to keep those things separate.

And then you could also probably .prepend() the whole dang bar to #xg_head, eliminating the need to override styles for #xn_bar's width and margin.

Also, you can leave type="text/javascript" off of <script> tags in the HTML5 specification. Same goes for <style> tags (but I see you've already done that here).

I haven't really tested this code much at all, but it should all work in theory.

Oh wow! Thanks David. I should have mentioned that I prefer the logo in the sign in box.

Hi Erik,

It looks very good to me, especially like the height:auto on xn_bar - - and adding the style for ningbar_logo in proper place. Sometimes I type so fast while thinking, may not come out with the cleanest final solution. I haven't tested it.

Thanks!

Jen

Jen, Thank you very much for this code, Now I have one more problem, How did you add the navigation menu to your Ning bar? I want to get rid of my navigation bar, the name of my website and the tagline words. Please help!

RSS

Latest Activity

Lady Panter favorited Rafael's group Ning Networks en español
2 hours ago
Dustin Craig replied to John Bizley's discussion 'Show Your Ning 3.0 Sites'
"Thanks!"
3 hours ago
Dustin Craig replied to John Bizley's discussion 'Show Your Ning 3.0 Sites'
"Let me send you a friend request so I can message you rather than take this thread more off-topic."
3 hours ago
Paul Corona replied to Suzie Nielsen's discussion 'Watching Cultivating videos- have questions!'
"So many folks were asking the same questions that I thought actually showing them the basics of the…"
5 hours ago
Chris replied to JFarrow's discussion 'Ning Emails Going to Spam?'
"Nope, had all the answers: "it's not a bug", "it is a bug and has been…"
6 hours ago
Larry Matthews replied to Larry Matthews's discussion 'Photos'
"www.dismyhood.com I need to enlarge images on mouseover, on the activity feeds. There is a feed for…"
6 hours ago
Fabio replied to Phil McCluskey's discussion 'Site Manager Updates for Ning 3.0 Networks'
"F A N T A S T I C !!!!! well done guys"
7 hours ago

NC for Hire
Jen replied to Jen's discussion 'Jen's Running List - Updated 4/6/2013' in the group The Sandbox
"Hi Allison, I have a Client who needs the Search feature. Any updates? I don't see any Search…"
7 hours ago

© 2013   Created by Ning.

Badges  |  Report an Issue  |  Terms of Service