1

私のtumblrベースのホームページに愚かなJavascriptの組み合わせを使用して、ホバー時にランダムに配置されたサムネイルを表示し、クリックすると大きな画像を取得します. いくつか問題があります:

  1. tumblr は自動的に段落内にテキストを配置するため、リンク 1 の後ろにスペースが作成されます (「,」ではうまく機能しません)。

  2. 動画を大きくして再生すると、表示が崩れても再生が続きます。

  3. リンクの前のテキストの後ろにワードラップを作成するための解決策が見つかりません。Lorem Ipsum

    は、印刷および植字業界の単なるダミー テキストです。
    リンク 1、リンク 2

また、画像リンクを 2 回書かなければなりませんが、それは我慢できます。

誰かが私を助けてくれたらとても感謝しています。

ps。実際の動作はこちら: http://roingbaer.com

$(".front").each(function() {
 var right = Math.floor(Math.random()*800);
 var top = Math.floor(Math.random()*500);

 $(this).css({'margin-right': right});
 $(this).css({'margin-top': top});
});

hoverdiv = $("div.hover")

hoverdiv.on("hover", function() {
$(this).children(".front").show()
});
hoverdiv.on("mouseleave", function() {
$(this).children(".front").hide()
})
hoverdiv.on("click", function() {
$(this).children(".back").toggle()
$(this).children(".front").hide()
});​

CSS

p { margin:0;
padding:0;
display:inline;
}

.back { 
display:none;
width:100%;
height:100%;
position:fixed;
top:0;
text-align:right;
}

.front
{ 
display:none;
max-height:200px;
max-width:auto;
position:fixed;
z-index:-50;
top:0;
right:100px;
}

img{ 
max-width:inherit;
max-height:inherit;
right:0;
top:0;
}


.hover { 
cursor:pointer;
margin:0;
padding:0;
font-style:italic;
display:inline;
}

HTML

  <div class="text">
      <p>Lorem Ipsum is simply dummy</p>
<div class="hover"><a href="http://example.com">text</a>
<div class="front"><img src="http://images.roingbaer.com/ludvig.png"/></div>
</div>
<p>, of the printing and typesetting industry.</p>

<div class="hover">Link 1
<div class="front"><img src="http://24.media.tumblr.com/tumblr_lyz7fjMdnN1rp3eymo1_r2_500.jpg"/></div>
<div class="back"><img src="http://24.media.tumblr.com/tumblr_lyz7fjMdnN1rp3eymo1_r2_500.jpg"/></div>
</div>
<p>,</p>
<div class="hover">Link 2
<div class="front"><iframe frameborder="0" height="233" src="http://www.youtube.com/embed/VMeXGE_a8Gg" width="400"></iframe></div>
<div class="back"><iframe frameborder="0" height="480" src="http://www.youtube.com/embed/VMeXGE_a8Gg" width="853"></iframe></div>
</div>
    </div>

    ​
4

0 に答える 0