We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
[ C ] Looking to add military rank insignias
Topic Started: Jan 12 2015, 10:59 AM (638 Views)
Genosplace
Member Avatar
Member
[ *  * ]
I'm using a very nice code that adds a country flag under a persons avatar and am wondering if something else can be done like it. I want to add an option where people who have served can choose their military insignia and text and add it under their avatar. Would like a change size option that I can set in the code but I'm thinking around 100 x 100 or maybe a little more. Avatars are set at 180 x 180 and would like to play with size to see what looks right.

Example -

Avatar
Title

Posts: 36
Group: Member
Member #10
Joined: January 1, 2015

Military Member - (Marines, Air Force, etc, here)
insignia here(centered under text)


Country flag



Is this something that can be done?

Thanks for any help with this. :)
Edited by Genosplace, Jan 12 2015, 11:00 AM.
Offline Profile Goto Top
 
Replies:
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
<script type="text/javascript">
$('dl.user_profile dt:contains(Military Member)').addClass('c');
</script>
Add that below the code.
Offline Profile Goto Top
 
Genosplace
Member Avatar
Member
[ *  * ]
Thanks again Cody, it's all done now and looks the best thanks to you. :up:


Ready for the next request or do you need a break from me? :lol: It goes in the same box area...
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Feel free to make the request and if I don't get around to it, someone else may.
Offline Profile Goto Top
 
Helena
Member Avatar
M is for Mod

Topic reopened by request of the OP.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Why was this reopen; what do you need assistance with?
Offline Profile Goto Top
 
Genosplace
Member Avatar
Member
[ *  * ]
Morning Cory.

After I added the resize code at the bottom the X you put in there for no selection disappeared.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Please post the edited version of the code here.
Offline Profile Goto Top
 
Genosplace
Member Avatar
Member
[ *  * ]
Here it is Cory and thanks for looking at it.


Code:
 
<script type="text/javascript">
// <![CDATA[
$(function() {
var militaryN = ['None', 'US Air Force', 'US Army', 'US Coast Guard', 'US Marine Corps', 'US Navy'];
var militaryI = ['http://z3.ifrm.com/63/1/0/p482463/none.png', 'http://z2.ifrm.com/10745/197/0/p1076913/US_Air_Force_180.png', 'http://z2.ifrm.com/10745/197/0/p1076914/US_Army_180.png', 'http://z2.ifrm.com/10745/197/0/p1076915/US_Coast_Guard_180.png', 'http://z2.ifrm.com/10745/197/0/p1076916/US_Marine_Corps_180.png', 'http://z2.ifrm.com/10745/197/0/p1076917/US_Navy_180.png'];

$('dl.user_profile dt:contains(Military Member)').next('dd').each(function() {
for (var x = 0; x < militaryN.length; x++) {
if (militaryN[x] === $(this).text()) {
$(this).html('<img src="' + militaryI[x] + '" alt="' + militaryN[x] + '" title="' + militaryN[x] + '" style="width: 145px; height: 145px" /></a>');
}
}
});

$('#edit_profile td:contains(Military)').next('td').append('<a href="javascript: void(0);" id="military-open">Choose Military Membership</a><div id="military" style="display: none"></div>');

$('#edit_profile td:contains(Military)').next('td').find('option').each(function() {
$(this).parent('select').hide();

for (var x = 0; x < militaryN.length; x++) {
if (militaryN[x] === $(this).text()) {
$('#military').append('<img src="' + militaryI[x] + '" alt="' + militaryN[x] + '" title="' + militaryN[x] + '" style="cursor: pointer; opacity: 0.5; display: inline-block; padding: 5px 10px" />');
}
}

$('#military-open').click(function() {
var pos = $('#military').position();
$(window).scrollTop(pos.top);
$(this).hide();
$('#military').fadeIn('slow');
});

$('#military img').click(function() {
$('#military img').css('opacity', '0.5');
$(this).css('opacity', '1.0');
var index = $(this).index();

if (index === 0) {
index = $(this).index() - 1;
}

$(this).parent('#military').parent('td').find('select').val(index);
});
});

var military = parseInt($('#edit_profile td:contains(Military)').next('td').find('select').val(), 10);
var nMilitary = military;
$('#edit_profile td:contains(Military)').next('td').find('#military img:eq(' + nMilitary + ')').css('opacity', '1.0');
});
// ]]>
</script>
<script type="text/javascript">
$('dl.user_profile dt:contains(Military Member)').addClass('c');
</script>
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
The code looks fine. I would re-copy and paste the 'Choices' for the profile field to ensure they're accurate.
Offline Profile Goto Top
 
Genosplace
Member Avatar
Member
[ *  * ]
I don't even see that in there.

The choices in your original 1st part of the code -

None
US Air Force
US Army
US Coast Guard
US Marine Corps
US Navy


Where would I put that?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You have 'None' in the 'Choices' field and the 'militaryN' array, and you have the image URL for 'None' in the 'militaryI' array, therefore the red X to choose no military member rank should be appearing, but you're saying it's not, right?
Offline Profile Goto Top
 
Genosplace
Member Avatar
Member
[ *  * ]
I went back and checked the choices and the none was gone. I don't know how as it worked before. :facepalm:


Thanks again Cory.
Offline Profile Goto Top
 
Helena
Member Avatar
M is for Mod

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2