PDA

View Full Version : درخواست اسکریپت بزرگ کردن عکس



DR.HTML
یک شنبه 12 دی 1389, 12:00 عصر
سلام ببخشید
من یه صفحه با html ساختم یه کد جاوا میخوام که وقتی میری روی اون عکس عکس یه مقداری بزرگ بشه بعد یه توضیخ زیرش بیاد ؟ میشه همچین کاری کرد ؟

hossin.esm
یک شنبه 12 دی 1389, 15:23 عصر
این یک مثال کوچک هست .
اگر جستجو کنید مثال های زیاد و جالبی وجود دارد.

<div>
<img id="big" src="1.jpg" onmouseover="over(300,300)" onmouseout="out(200,20)"/>
<div id="comm">test</div>
</div>
<style>
#big{
height:200px;
width:200px;
position:absolute;
}
#comm{
display:none;
position:absolute;
text-align:center;
color:#F00;


}
</style>
<SCRIPT type="text/javascript" >
var b=document.getElementById('big');
var c=document.getElementById('comm');
function over()
{

b.style.height=b.height+100+'px';
b.style.width=b.width+100+'px';
c.style.top=b.height-10+'px';
c.style.left=b.width/2+'px';
c.style.display='block';

}
function out(w,h)
{

b.style.height=b.height-100+'px';
b.style.width=b.width-100+'px';
c.style.display='none';
}

</SCRIPT>