html body.tc-body { background: url("path/to/image.jpg") no-repeat center center fixed; background-size: cover; height: 100%;}in a tiddler tagged with $:/tags/Stylesheet which I managed to accomplish successfully.
Now I fund out a few methods online (like this one) that can randomize i using java script or jquery, is there a way to adapt this or use it inside tiddlywiki?
I tried to adapt that but my basic copy-pasting techniques are insufficient here.
Thanks for the help
Sorry for the delay in replying.
Well this sounds very interesting, have to give it a try myself when I'm back at the computer.
My main interest in this would be to have it randomly change the background on each page load, so I will probably have to check that plugin too
Thanks a lot for the tips I'll have a look at them
Sent from Nokia 3210
Now that is seriously cute.
--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/QKBoH-71384/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
<html>
<head>
<script type="text/javascript">
var totalCount = 10;
function ChangeIt()
{
var num = Math.ceil( Math.random() * totalCount );
// Number padding
function pad(n) {
return (n < 10) ? ("0" + n) : n;
};
var pnum = pad(num)
document.body.background = 'path/to/image'+pnum+'.jpg';
}
</script>
</head>
<body>
Content
</body>
</body>
<script type="text/javascript">
ChangeIt();
</script>
</html>
That looks like a good way to do it. It may be possible to include those scripts in a tiddlywiki using the $:/tags/RawMarkup tag. I am not sure if it would run the script when loading the page or not though.
<script type="text/javascript">
var totalCount = 10;
function ChangeIt()
{
var num = Math.ceil( Math.random() * totalCount );
// Number padding
function pad(n) {
return (n < 10) ? ("0" + n) : n;
};
var pnum = pad(num)
document.body.background = 'path/to/image'+pnum+'.jpg';
}
</script>
</body>
<script type="text/javascript">
ChangeIt();
</script>
</html>
That's the part that is probably only possible in 5.1.8, right?
Also the document.body.background = 'path/to/image'+pnum+'.jpg'; would probably need some adjustments too, like
replacing with html body.tc-body and the rest of the background image style, right?
If you are going to use javascript there shouldn't be any trouble with the current version. The only place you can put raw javascript is in the head using $:/tags/RawMarkup, so just try making a tiddler with both scripts and tag it with $:/tags/RawMarkup and see what happens.
body.tc-body {background: url("media/backgrounds/background<$view field="value"/>.jpg") no-repeat center center fixed;
background-size: cover; height: 100%;}
<$button>
<$action-randval $step=01 $field=value $lower=00 $upper=18/>
Change Background
</$button>
<$action-randval> on load...
Is this possible with 5.1.8, or by using any special tag?