You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
1.7 KiB
JavaScript

// all jQuery stuff here
$(document).ready(function() {
//newspaper passage iframes
$(document).on('click', '#paper_1', function(){
$("#readme_1").show();
});
$(document).on('click', '#paper_2', function(){
$("#readme_2").show();
});
$(document).on('click', '#paper_3', function(){
$("#readme_3").show();
});
$(document).on('click', '#paper_4', function(){
$("#readme_4").show();
});
});;
$(document).ready(function() {
//switch story divs
$("#switchTo2_newspaper").click (function(){
$("#2_park_newspaper").show();
$("#1_park").hide();
});
$("#switchTo1_news").click (function(){
$("#1_park").show();
$("#2_park_newspaper").hide();
$("#readme_1,#readme_2,#readme_3,#readme_4").hide();
});
$("#switchTo2_walk").click (function(){
$("#2_park_walk").show();
$("#1_park").hide();
$("#gardenSpace").show();
});
$("#switchTo1_walk").click (function(){
$("#2_park_walk").hide();
$("#1_park").show();
$("#gardenSpace").hide();
});
//readme 1 salmonRoll
$('.readme').hover(
function(){ $('.salmonRoll1').addClass('pink')},
function(){ $('.salmonRoll1').removeClass('pink')
});
// garden moving box
var pane = $('#pane'),
box = $('#square'),
w = pane.width() - box.width(),
d = {},
x = 3;
function newv(v,a,b) {
var n = parseInt(v, 10) - (d[a] ? x : 0) + (d[b] ? x : 0);
return n < 0 ? 0 : n > w ? w : n;
}
$(window).keydown(function(e) { d[e.which] = true; });
$(window).keyup(function(e) { d[e.which] = false; });
setInterval(function() {
box.css({
left: function(i,v) { return newv(v, 37, 39); },
top: function(i,v) { return newv(v, 38, 40); }
});
}, 20);
});;