我不能完全弄清楚爲什麼這不起作用。我有一些文字介紹右邊的圖片。當用戶滾動查看圖像時,我希望文字逐漸消失。我已經看到很多垂直文本使用相同的代碼淡入淡出的例子,但由於某種原因,這不適用於我。有人看到我做錯了什麼?我有以下的javascript代碼:水平滾動jQuery文本不透明
<script>
$(document).bind("projectLoadComplete", function(){
if ($(".project_intro")[0]){
var divs = $('.project_intro');
$(window).bind('scroll', function() {
var st = $(this).scrollLeft();
divs.css({ 'opacity' : (1 - st/250) });
if (divs.css('opacity') < 0) {
divs.css('opacity', 0);
}
});
}
});
</script>
和下面的HTML代碼:
<div class="project_intro">This is some intro text that I want to fade when the user scrolls left.</div>
<table height="100%" style="height: 100%; margin-left: 300px;" valign="middle">
<tr>
<td>{image 1}</td>
<td>{image 2}</td>
</tr>
</table>
看起來你的代碼是好的減去一些主觀的變化。我會看看[這個鏈接](http://support.cargocollective.com/customer/portal/questions/1282858-projectloadcomplete-not-triggering-)關於你的「綁定」。此外,如果您可以提供更多信息,例如控制檯中的任何錯誤,或者您可以手動觸發它,那將會很有用。 – Fluidbyte