2

このサイトの誰かに、私が抱えていたスライダーの問題を解決してもらいました。パズルの最後のピースを手伝ってくれる人が必要です.

これはフィドルhttp://jsfiddle.net/gajjuthechamp/vrqdh/2/です

「サムネイル」をクリックすると、コンテンツが上のメイン div に表示されます。

「extraContent」の下の div/サムネイルには、「mainContent」の下に独自のコンテンツ div が必要です。

これが理にかなっていることを願っています。

ありがとう

jQuery:

$(function(){
  $("#parent").on("click", ".extraContent div", function(){
       newHtml=$(this).html();
       $("#parent").find(".mainContent p").fadeOut(1000,function(){
              $(this).parent().html(newHtml);
              $(this).parent().fadeIn(1000);
       });
    });
});

HTML:

<div id="parent">
    <div class="mainContent"> <p>This is the default Text</p></div>
    <div class="extraContent">
        <div><p>test and Image Goes hear for 1 div</p></div>
        <div><p>test and Image Goes hear for 2 div</p></div>
        <div><p>test and Image Goes hear for 3 div</p></div>
        <div><p>test and Image Goes hear for 4 div</p></div>
    </div>
</div>

CSS:

#parent { width:400px; margin:auto}
.mainContent { width:430px; height:300px; border:1px solid #000;padding:5px; }
.extraContent {overflow:auto; width:450px;}
.extraContent div{float:left; width:90px; height:90px; border:1px solid #00F; margin:5px; padding:5px }
.extraContent div:hover { border:1px solid #0F0;cursor:pointer }
4

1 に答える 1

1

jsFiddle デモ

HTML:

<div id="parent">
    <div class="mainContent">
        <div class="cont"> Content 1....</div>
        <div class="cont"> Content 2....</div>
        <div class="cont"> Content 3....</div>
        <div class="cont"> Content 4....</div>  
    </div>
    <div class="extraContent">
        <div><p>1 Custom content here</p></div>
        <div><p>2 Custom content here</p></div>
        <div><p>3 Custom content here</p></div>
        <div><p>4 Custom content here</p></div>
    </div>
</div>

追加された CSS:

.cont{position:absolute;}

jQuery:

$(function(){
  $('.cont:gt(0)').hide();
  $("#parent").on("click", ".extraContent div", function(){
       var ind = $(this).index();
       $("#parent").find(".cont").stop().fadeTo(600,0,function(){
           $('#parent').find('.cont').eq(ind).stop().fadeTo(300,1);
       });
    });
});
于 2012-08-30T22:10:05.377 に答える