そのため、要素の半分だけを表示できるようにしたいと考えています。これで、次のようなことができます。
function half($elem,which){
//here I would get the scrolling position
//of the element $elem along with the outer
//width and outer height. Then, depending on
//what 'which' is (left,right,top,bottom), the
//function would append an element with the same
//background color as the body background in
//order to cover the correct part of the element
};
しかし、単純な css や JavaScript で要素の一部のみを表示 (または切り取り) するように設定できる場合、それは不要なアイテムを DOM に追加するだけです。それは可能ですか?もしそうなら、どのように?
アップデート:
皆さんが推測しようとしていると思いますが、コンテナに常にコンテンツを追加するフィドルを次に示します。私の質問に答えるには、追加される特定の div の css を変更して、コンテンツの指定された半分のみを追加する関数が必要です。