2013-09-10 4 views
0

목표는 링크 색상을 변경하는 것이지만 호버 상태의 색상을 변경하는 것입니다. .

이 완벽하게 작동합니다 :
jQuery를 ("몸") CSS ("배경 색", ui.color.toString());

호버의 색상을 변경하려면 호버의 색상을 변경하려면 작동하지 않습니다.
jQuery ("a : hover"). css ("color", ui.color.toString());아이리스 컬러 피커

전체 스크립트는 다음과 같습니다

 
$('#wide-load').iris({ 
     width: 170, 
     hide: false, 
     palettes: ['#125', '#459', '#78b', '#ab0', '#de3', '#f0f'], 
     change: function(event, ui) {   
       jQuery("body").css("background-color", ui.color.toString()); 
       jQuery("a:hover").css("color", ui.color.toString()); 
     } 
});


온라인 스크립트 : 나는 당신이 요청하지만 똑같은 고생, 그리고 마지막으로 발견 이후이 개월되었습니다 알고 http://automattic.github.io/Iris/

답변

0

해결책. 나를 위해 작동 무엇

body에 빈 <div> 매번 그렇게처럼 색상을 변경 jQuery를 사용 후 내부 <style> 태그를 인쇄 추가하는 것입니다

function changeHoverColor(){ 
    /* 
    check if your '#custom-css' div exists on page 
    if not then create it and append it to the body 
    */ 
    if($('#custom-css').length < 1){ 
     var $cssDiv = $('<div id="custom-css">'); 
     $cssDiv.appendTo('body'); 
    } 

    var myColor = '#ff7700'; //change this to your color 

    /* change the below css to fit your needs */ 
    var myStyle = '<style>a:hover{color:'+myColor+';}</style>'; 

    /* 
    finally print it inside your div. 
    Now, every time you pick a color, your new css will be generated and will 
    overwrite the previous one inside the '#custom-css' div 
    */ 
    $('#custom-css').html(myStyle); 
} 

는 도움이되기를 바랍니다. 건배

+0

고마워! 그것은 많은 도움이 .. –