views:

35

answers:

0

OK, some I'm using jPlayer for some music on my site, and I have an opt out functionality that I would like to implement here, but I need a little help getting started.

So, I've set a cookie:

$.cookie('autoPlay', 'no', { expires: 365 * 10 });

So, I like to set up a conditional as follows:

if(cookie == 0) {
  noMusic;
} else {
  playMusic
}

The reason I have it set up like this, is so that it autoplays by default, and only doesn't autoplay if you opt out. Because, when opting out of my service, you are given the choice of navigating the site "Without Music" or "With Music". Therefore, I just leave the cookie be if the end-user chooses "With Music", but set it to a certain value only if they opt out by choosing "Without Music", therefore, it'll autoplay by default.

I need some help with my assignment condition for the if statement however. I'm a little unused to jQuery's syntax with this.

Also, I need to find out how to not play the music, and how to specify to play it. I need to grab the right piece of code form the jPlayer plugin I guess.

Any help is awesome and appreciated!

Thanks!