![]() |
conditional background position link based on current position
I have a script that works great except one small problem. It's easiest to explain with visual aid http://avalon.eaw.com/#finishes
this uses the background position property to animate the color changes. the only problem is that the "horn" options are hard-coded such that if you are currently viewing a speaker that has white cab with a colored horn and want to change the cabinet to black, it changes the horn to black as well. there is no way currently to view a black cab with colored horn. to fix it i need to make a conditional statement but am not sure how to make it work. something like: Code:
function colorChange() { |
Quote:
If statement must be in parentheses. Code:
if $("#target").css('background-position') == {x:-754} {Code:
if |
i feel like it's *this close*
okay, so really what i want to do is have a single piano swatch check to see where the background position currently is. if it's xposition is -1131 i want it to return an xposition of -377. if it's not -1131 it needs to return to 0. i've been reading up a bit more on jquery shorthand and thought maybe this would work but it doesn't
Code:
function colorChangePiano() {Code:
var xposition, Code:
<a href="#" onclick="updatePositions({x:-1131})"><img src="/images/cabinets/swatches/swatch-siren.jpg" /><p>siren</p></a>also, if there WAS a conditional statement for the single piano swatch, would the html call then look like this? Code:
onclick="updatePositions()" |
Answer... sortof
A solution - but not the real answer - came courtesy of my friend Eli Huntington (thanks Eli!). A simpler question closer to the original is posted to stackoverflow.com and if anyone cares to try an answer (or reap the results) head over here. I still beleive there is a much less complicated way of achieving this through jquery. The original scripts and code is over at avalonbyeaw.com/index_testes.html so we can keep tinkering with possible solutions.
Here's the solution that got Avalon by EAW's finishes page working: Code:
// FINISHES SCRIPT //Code:
<!-- FINISHES --> |
| All times are GMT +1. The time now is 10:39 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.