add ribbon

This commit is contained in:
trichimtrich 2019-06-10 23:53:52 +08:00
parent 74c33cdb18
commit 3d5206fcc4
2 changed files with 15 additions and 0 deletions

1
static/game.html vendored
View file

@ -75,6 +75,7 @@
<div id="btn-help" unselectable="on" class="btn unselectable" value="help">Help</div>
</div>
<a id="ribbon" style="position: fixed; right: 0; top: 0;" href="https://github.com/giongto35/cloud-game"><img width="149" height="149" src="https://github.blog/wp-content/uploads/2008/12/forkme_right_gray_6d6d6d.png?resize=149%2C149" class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1"></a>
<script>
DEBUG = true;

14
static/js/init.js vendored
View file

@ -15,6 +15,20 @@ function fixScreenLayout() {
// targetWidth = 800; targetHeight = 600; // test on desktop
fixElementLayout($("#gamebody"), targetWidth, targetHeight);
var elem = $("#ribbon");
var st = "";
if (isLayoutSwitched) {
var st = "rotate(90deg)";
elem.css("bottom", 0);
elem.css("top", "");
} else {
elem.css("bottom", "");
elem.css("top", 0);
}
elem.css("transform", st);
elem.css("-webkit-transform", st);
elem.css("-moz-transform", st);
}
$(window).on("resize", fixScreenLayout);