Can I restrict playing French music only when the "world" angle is between 0 degrees and 27 degrees? The world rotates based on scrolling. Thank you, everyone :)
$(document).ready(function() {
var angle,
scroll = 0;
var $world = $('#world');
var $body = $('body');
// French music var $french = $('#french');
$(window).scroll(function() {
angle = $body.scrollTop() / 28;
$world.css('-moz-transform', 'rotate('+angle+'deg)').css('-webkit-transform', 'rotate('+angle+'deg)').css('-o-transform', 'rotate('+angle+'deg)').css('-ms-transform', 'rotate('+angle+'deg)');
$(french)[0].play();
console.log(scroll);
});
});
update
Is this right? I still can't play any other music besides the first one (French).
if(angle >=0 && angle <=26) {
$(french)[0].play();
}
if(angle >27 && angle <=74) {
$(british)[1].play();
}
if(angle >75 && angle <=115) {
$(ny)[2].play();
}
if(angle >116 && angle <=164) {
$(la)[3].play();
}
if(angle >165 && angle <=210) {
$(japanese)[4].play();
}
if(angle >211 && angle <=270) {
$(chinese)[5].play();
}
if(angle >271 && angle <=310) {
$(indian)[6].play();
}
if(angle >311 && angle <=333) {
$(egyptian)[7].play();
}