I’m trying to create a script in which I can set the background color gradient with a colorpicker and are using 2 functions to create this, but… Is it possible to do this within 1 function?
This is what i have so far:
From: <input name="backfrom" id="backfrom" class="color" onchange="bcolorFrom(this.color);" style="width:60px;" value="">
To: <input name="backto" id="backto" class="color" onchange="bcolorTo(this.color);" style="width:60px;" value="">
And the javascript:
function bcolorFrom(c){
var f = document.getElementById('backto').value;
jQuery("#mif").contents().find("body").css("background", '-webkit-gradient(linear,left top,left bottom, color-stop(0,#'+c+'), color-stop(1,#'+f+'))');
}
function bcolorTo(c){
var f = document.getElementById('backfrom').value;
jQuery("#mif").contents().find("body").css("background", '-webkit-gradient(linear,left top,left bottom, color-stop(0,#'+f+'), color-stop(1,#'+c+'))');
}
Hoping for help and thanks in advance