.css bug when supplying parameters...
Hi,
This could be considered a tough bug, needing some sort of super expert help.
I have multiple $(document).ready() blocks.
One of them looks like this:
- $(document).ready(function () {
- var pos = $('.NavigationItemSelected').position();
- var width = $('.NavigationItemSelected').width();
- var lastpos = $('.NavigationItem').last().position();
- $('#selected-nav').css({
- 'left': (pos.left + "px"),
- 'display': 'block'
- });
- if (pos.left - 5 > 0) {
- $("#unselected-left").css({
- "left": "0px",
- "width": (pos.left - 5) + "px",
- "display": "block"
- });
- }
- if ((lastpos.left - pos.left) - 6 > 0) {
- $("#unselected-right").css({
- "left": (pos.left + width + 10),
- "width": ((lastpos.left - pos.left) - 6),
- "display": "block"
- });
- }
- });
What happens is that this code runs absolutely fine, however subsequent blocks don't run at all - no errors either.
I drilled it down and found that
- $('#selected-nav').css({
- 'left': '30px',
- 'display': 'block'
- });
Works just fine, but
- $('#selected-nav').css({
- 'left': (pos.left + "px"),
- 'display': 'block'
- });
fails, even if the + "px" is removed.
So is this a bug with JQuery or am I some kind of massive idiot?
Ryan.