I want to change the site background color according to slide image? How can i do that? i tried to add some Javascript instead of text to the slide but this doesn´t work.
In fact it should fade between the colors. Can you give me a hint?
document.getElementById(body).style.background ='#cccccc';
Hi, you can use slider's javascript api, and on the slide change function get the slide number, and set the color according the slide number. Please check the slider api in slider settings page.
Hi, please call the doSliderAPI from the script.js file from the front end from the end of the template. The problem is that the function is called before the revapi is created. Another option is to call it after some timeout.
like setTimeout(doSliderAPI,2000)
everything else is normal copy / paste from slider options.
Hi, you can use slider's javascript api, and on the slide change function get the slide number, and set the color according the slide number. Please check the slider api in slider settings page.
Hello Max, thank you!
i tried to paste this: <script type="text/javascript"> revapi1.revcurrentslide(); </script> in output.class.php
seems not to be the right way to use the api.
Can you give me a hint?
thanks,
I just tried this in a seperate .js file:
but i think again in the wrong file. Maybe the code is right, but i don´t know where to put it in...
thanks again!
Hello Max,
it´s getting more clear for me. But if i paste the content of the API in my templates .js i get an error in my console.
This is what i pasted:
revapi1.bind("revolution.slide.onchange",function (e,data) {
alert("slide changed to: "+data.slideIndex);
});
Error: "ReferenceError: Can't find variable: revapi1
global code script.js"
If i paste it at the bottom of the body it says:
TypeError: 'undefined' is not an object (evaluating 'revapi1.bind')
Hello Max,
i just put in your lines and saved. Now the file should be ok the be saved.
thank you,
Elisa
Hi, please call the doSliderAPI from the script.js file from the front end from the end of the template. The problem is that the function is called before the revapi is created. Another option is to call it after some timeout.
like setTimeout(doSliderAPI,2000)
everything else is normal copy / paste from slider options.
do you understand the solution?
Hello Max! Thanks, done :-)