display troubles

Started by Shadow, April 30, 2012, 08:15:38 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Sharptooh

#15
Sounds like something that would be pretty easy to implement via jQuery or YUI. I could probably accomplish it pretty quickly with either.

Can't think exactly of how to do that in JavaScript of the top of my head (I can read JavaScript, haven't coded any from nothing for a while though) sure I could do it with enough time (and assistance from Google)

Pippin

Nazgul (#5) (9 min idle)
Shores of Tripoli (#8) (9 min idle)
Dumbledore (#12) (9 min idle)
Cold Conifers (#20) (9 min idle)
Teardrop (#22) (9 min idle)

all the idle times are the same and seem to vary wide from 39 mins to 9 mins etc its sorta confusing
1. Mike Oxlong (#14)
$16,999,999,999 with 275,000 Acres
3. AL CAPONE (#23)
$887,873,381 with 14,939 Acres
3. wrecking balls (#9)
$801,398,171 with 32,301 Acres
1. Nazgul (#5)
$1,503,190,327 with 201,952 Acres

Peace Alliance

#17
The idle variable will be fixed tonight when Wondy wands his wand.


Sharpy,

It doesn't require jQuery so far as I know because all the data I need to show is there already, it's just flipping between hidden and visible.

Sharptooh

Yeah I know it doesn't require jQuery, I just usually use jQuery/YUI instead of JavaScript because JavaScript is a kind of horrible language to code in :/ it also means if you ever want to code something more complicated it is easy to do so, and it would enable use of selectors so you don't have to include JS in the HTML of the page.

TBH your friend is probably better off looking at it than I am, if for whatever reason though he can't look at it for a while I'd be happy to help try and fix it.

Ian2424

Whelp (#4) (15460 days idle)
Shores of Tripoli (#8) (15460 days idle)
Dumbledore (#12) (15460 days idle
LOL!
Uhh, it's needs to be about 20% cooler.
Quote from: Krowdon on April 28, 2012, 07:53:37 AM
*beats Night Wolf with a penguin*

Krowdon

Quote from: Shadow on April 30, 2012, 08:15:38 AM
If you find any little display glitches, post them here!

If any of your display bar boxes (cash, turns, food, etc) get too big, the ones on the end get pushed off the bar into no man's land and mess with the display of stuff below it.

This happens to me. Also, I cant select warlord names to see their stats or send messages.
Quote from: Ashyra Nightwingi have work to do and that is why i'm playing rwl, this is how it always works

Shadow

by see their stats you mean kills, offenses, cities, etc right?
<=holbs-.. ..-holbs=> <=holbs-..

Colonel Yuri


Krowdon

Quote from: Shadow on April 30, 2012, 07:56:10 PM
by see their stats you mean kills, offenses, cities, etc right?

yes that is what I mean by stats. The little question marks next to the numbers dont show up, and clicking on their names does nothing.
Quote from: Ashyra Nightwingi have work to do and that is why i'm playing rwl, this is how it always works

Ian2424

Yuri, you know that MW's old pic? I miss that guy.
Uhh, it's needs to be about 20% cooler.
Quote from: Krowdon on April 28, 2012, 07:53:37 AM
*beats Night Wolf with a penguin*

Shadow

Quote from: Krowdon on April 30, 2012, 08:25:01 PM
Quote from: Shadow on April 30, 2012, 07:56:10 PM
by see their stats you mean kills, offenses, cities, etc right?

yes that is what I mean by stats. The little question marks next to the numbers dont show up, and clicking on their names does nothing.

clicking the name should bring up the little stats box you are talking about
<=holbs-.. ..-holbs=> <=holbs-..

Peace Alliance

Quote from: Krowdon on April 30, 2012, 08:25:01 PM
Quote from: Shadow on April 30, 2012, 07:56:10 PM
by see their stats you mean kills, offenses, cities, etc right?

yes that is what I mean by stats. The little question marks next to the numbers dont show up, and clicking on their names does nothing.

Clicking the name should bring up a pop up. What browser are you using, and which version?

Sharptooh

I've had a quick look at the JavaScript making the menu, you're using the hideshow() JavaScript function to toggle the display property of the drop down ul's (between display: none and display: block )

For example here is some code you use
Quote
      <li id="information-menu" class="menu-drop-down"><a href="javascript:hideshow(document.getElementById('information-drop'))">Information</a>
           <ul id="information-drop" style="display: none;" class="menu-dropped">
                  <li><a href="rwl.php?action=status">Army Status</a></li>
                  <li><a href="rwl.php?action=search">Warlord Search</a></li>
                  <li><a href="rwl.php?action=rattack">Attack History</a></li>
           </ul>
      </li>

The problem with this code as that the JavaScript is only toggling one element at a time (in this case it is toggling the display property of the unordered list with an id of "information-drop")

Therefore you could already have other elements with a display set to block when you toggle the visibility of this one.

The elements to the right still work when clicked on because their HTML comes after the HTML of nav elements to the left (if that makes sense?) therefore they take display preference (like the cascade in CSS) because they appear later on in the HTML document.

The only real way I can think of fixing this is to set the display property to none for all of the drop down lists when any nav element is clicked, and then toggle the display of the current element being clicked. You could accomplish this by selecting all of the drop down menu's via JavaScript's class selector like such:

document.getElementsByClassName('menu-dropped').style.display='none'

You would then have to select the nav via the id selector and change it's display to block, the end code would look like:

<a href="javascript:document.getElementsByClassName('menu-dropped').style.display='none';document.getElementById('information-drop').style.display='block'">Information</a>

However this is pretty messy code (and I haven't even tested it, so there's a possibility it's not bullet proof) it also (surprise surprise), doesn't work in any version of IE before IE9

You could pretty easily use a library (like I said, jQuery or YUI) to get around this, if you're really not interested in that there are some complex workarounds that I don't even fully understand

Peace Alliance

#28
What you are describing is what I was trying to accomplish last night on the test server. The hideshow script is as follows


<script type="text/javascript">
function hideshow(which){

if (!document.getElementById)
return

if (which.style.visibility=="visible")
which.style.visibility="hidden"

else
which.style.visibility="visible"
}
</script>


So the only thing I need to add is your chunk at the beginning of that function. I was trying to do that last night, but when I add this line to the beginning of the function it just makes it so everythign remains hidden, nothing ever shows.
document.getElementsByClassName('menu-dropped').style.display='none'


Oh, and I don't intend to support anything under IE9. Only 3% of our returning users are using IE8.

Sharptooh

Ah cool :) glad that was helpful (even if it was only very slightly)

Quote from: Peace Alliance on May 01, 2012, 01:02:03 PM
Oh, and I don't intend to support anything under IE9. Only 3% of our returning users are using IE8.

Can't say I entirely agree with dropping support for <IE9 but I admit it is a pain to fix stuff for it.

Has IE usage dropped again too? According to Wondow it was about 30% last I heard?