0

とにかく、スクロールする緑の div をページの上にスクロールするのではなく、黒いナビゲーションをページの上に押し上げることができますか?

これが私の例です。ページを下にスクロールすると、バナーがフェードしてスクロールします。

http://www.mharrisweb.co.uk/

Jquery が追加されました:

jQuery(function($) {

  function scrollBanner() {
    //Get the scoll position of the page
    scrollPos = jQuery(this).scrollTop();

    //Scroll and fade out the banner text
    jQuery('.hero-unit').css({
      'margin-top' : -(scrollPos/3)+"px",
      'opacity' : 1-(scrollPos/300)
    });

    //Scroll the background of the banner
    jQuery('.fade').css({
      'background-position' : 'center ' + (-scrollPos/8)+"px"
    });    
  }

  jQuery(window).scroll(function() {        
    scrollBanner();        
  });`

このサイトと同じ効果が欲しい:

http://themetrust.com/demos/hero/

4

1 に答える 1

0

たぶん、div.navbar-fixed-topスクロール動作を追加することもできますか?と.hero-unit。したがって、同じ「速度」で移動します

于 2013-02-06T11:18:33.353 に答える