2014-10-07 38 views
0

創建平面,龍影系列,我想創建一個範圍滑塊text-shadow這樣的:如何在jQuery的

text-shadow: rgb(18, 128, 106) 1px 1px, 
    text-shadow: rgb(18, 128, 106) 1px 1px,                        
    rgb(18, 128, 106) 2px 2px, 
    rgb(18, 128, 106) 3px 3px, 
    rgb(18, 128, 106) 4px 4px, 
    rgb(18, 128, 106) 5px 5px, 
    rgb(18, 128, 106) 6px 6px, 
    rgb(18, 128, 106) 7px 7px, 
    rgb(18, 128, 106) 8px 8px, 
    rgb(18, 128, 106) 9px 9px, 
    rgb(18, 128, 106) 10px 10px, 
    rgb(18, 128, 106) 11px 11px, 
    rgb(18, 128, 106) 12px 12px, 
    rgb(18, 128, 106) 13px 13px, 
    rgb(18, 128, 106) 14px 14px, 
    rgb(18, 128, 106) 15px 15px, 
    rgb(18, 128, 106) 16px 16px, 
    rgb(18, 128, 106) 17px 17px, 
    rgb(18, 128, 106) 18px 18px, 
    rgb(18, 128, 106) 19px 19px, 
    rgb(18, 128, 106) 20px 20px, 
    rgb(18, 128, 106) 21px 21px, 
    rgb(18, 128, 106) 22px 22px, 
    rgb(18, 128, 106) 23px 23px, 
    rgb(18, 128, 106) 24px 24px, 
    rgb(18, 128, 106) 25px 25px, 
    rgb(18, 128, 106) 26px 26px, 
    rgb(18, 128, 106) 27px 27px, 
    rgb(18, 128, 106) 28px 28px, 
    rgb(18, 128, 106) 29px 29px, 
    rgb(18, 128, 106) 30px 30px, 
    rgb(18, 128, 106) 31px 31px, 
    rgb(18, 128, 106) 32px 32px, 
    rgb(18, 128, 106) 33px 33px, 
    rgb(18, 128, 106) 34px 34px, 
    rgb(18, 128, 106) 35px 35px, 
    rgb(18, 128, 106) 36px 36px, 
    rgb(18, 128, 106) 37px 37px, 
    rgb(18, 128, 106) 38px 38px, 
    rgb(18, 128, 106) 39px 39px, 
    rgb(18, 128, 106) 40px 40px, 
    rgb(18, 128, 106) 41px 41px, 
    rgb(18, 128, 106) 42px 42px, 
    rgb(18, 128, 106) 43px 43px, 
    rgb(18, 128, 106) 44px 44px, 
    rgb(18, 128, 106) 45px 45px, 
    rgb(18, 128, 106) 46px 46px, 
    rgb(18, 128, 106) 47px 47px, 
    rgb(18, 128, 106) 48px 48px, 
    rgb(18, 128, 106) 49px 49px, 
    rgb(18, 128, 106) 50px 50px; 

有了這個jQuery代碼:

$('#Range').change(function() { 
    $('.divwidth').css({ boxShadow: this.value + 'px' }); 
}); 

THIS.VALUE =範圍值。

HTML:

<input type="range" name="amountRange" id="Range" value="250" min="0" max="500" step="1" oninput="this.form.amountInput.value=this.value" /> 
<input type="text" name="amountInput" id="textnumber" min="0" max="500" step="1" value="250" oninput="this.form.amountRange.value=this.value" /><span>px</span> 
+0

所以,當一個'input'元素的值已經改變了,你想要生成/應用一系列'box-shadow's?從「0px 0px」到什麼值?改變的「輸入」的價值? – 2014-10-07 16:15:27

+0

我想要惠普html範圍更改文本 - 影子px更改惠特範圍輸入 – 2014-10-07 16:19:10

+0

什麼HTML你有工作?順便說一句,不要發佈你的所有*代碼,我們不需要重複代碼的每一百行。縮寫,並使你的代碼簡潔。 – 2014-10-07 16:20:37

回答

0

猜測你想要的東西like this,儘管它因爲你用箱陰影和文字陰影在你的文字並不完全清楚。

$("input").change(function() { 
    var val = $(this).val(); 
    $("input").not(this).val(val); 
    $("#the-text").css({"textShadow":"rgb(18, 128, 106) "+val+"px "+ val+"px"}); 
}); 
+0

謝謝它的greate bu我想創建這樣的東西http://sandbox.juan-i.com/longshadows/ – 2014-10-07 16:43:30

0

這裏是小提琴

JS Fiddle

我不知道你想要什麼box-shadowtext-shadow所以創建無論是在撥弄我已經在3 rangex-axisy-axisblurbox shadow

function boxshadow() { 
     a = $('#Range').val() + 'px' 
     b = $('#Range1').val() + 'px' 
     c = $('#Range2').val() + 'px' 

     $('.test').css({ 'box-shadow': a + ' ' + b + ' ' + c + ' ' + '#888888'}) 

     $('.text').css({ 'text-shadow': a + ' ' + b +' ' + '#FF0000'}) 
} 

boxshadow() 

$('input[type=range]').on('change', function() { 
    boxshadow() 
}) 
+0

爲開始我想創建一個文本Flat,Long Shadow slide使用html範圍,但我不明白如何開始與我的代碼,如果你能展示我如何開始用我的代碼,我會非常高興:) – 2014-10-07 22:11:24