<script>
var element = document.getElementById("fullscreen-img");
function fullscreen() {
element.requestFullscreen
}
</script>
<img src="test" id="fullscreen-img">
<button onclick="fullscreen();">Open image in fullscreen</button>
<img src="test" id="fullscreen-img">
without using js you can wrap the image in a button or include a button with it using this
<$action-sendmessage $message="tm-full-screen" $param="enter"/>
<$button message="tm-full-screen" param="enter">
<img src="test.png">
</$button><$button message="tm-full-screen">
<img src="test_1.png">
</$button>
<$button message="tm-full-screen">
<img src="test_2.png">
</$button>
.tc-tiddler-frame {
/* This is necessary because otherwise position:fixed won't work. */
transform: none !important;
}
:fullscreen button img {
position: fixed;
top: 0px;
left: 0px;
width: 100vw;
height: 100vh;
}I need some way to keep track of which image is 'active'.
So the this works unless you have 2 images on the same page, because as the last one will always be on top. I thought maybe I could make the image a label for the button and a radio, but that doesn't seem to work. I need some way to keep track of which image is 'active'. Any suggestions?
- In tiddler A, each image should be in its own button.
- When that button is pressed tiddler B is opened and fullscreen is activated.
- Tiddler B would have the image in a different button, and have some CSS to make the button take up the entire browser window, which of course is currently fullscreen.
- When that button is pressed, the tiddler B is closed, which should automatically take us back to tiddler A, and fullscreen deactivated.
target="_blank"><img src="exampe.png"></a>. No messing with TiddlyWiki, this would open a HTML file in a new tab that just has a bit of JavaScript to catch the image source and go fullscreen, and some CSS to display the image in fullscreen.<!-- A button with an image inside. Call the function we define below with this element as the argument. -->
<button onclick="fullscreen(this);"><img src="test.png"></button>
<script>
function fullscreen(element) {
// Really we want the immediate child of the element we passed.
element = element.children[0];
// Request fullscreen.
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.mozRequestFullScreen) { /* Firefox */
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
element.webkitRequestFullscreen();
} else if (element.msRequestFullscreen) { /* IE/Edge */
element.msRequestFullscreen();
}
}
</script>I'm convinced this wouldn't be difficult to get this working within TiddlyWiki, but the documentation relating to this is so bad I don't know where to begin.