|
|
#1 (permalink) |
|
Üyelik Tarihi: 08.06.2007
Yer: Eskişehir
Mesaj: 32
|
üzerine tıklayınca orjinal boyut
Mesele bir resmin boyutu 1600 * 1200 ben bu resmi 1024 * 768 olarak görüntülemek istiyorum ve üzerine tıklayınca orjinal boytuna gelsin.
1024 * 768 den aşağısında boyutlandırma yapmasın. Yardımcı olabilir misiniz? |
|
|
|
|
|
#2 (permalink) |
|
Üyelik Tarihi: 14.10.2007
Yer: KOCAELİ
Mesaj: 391
|
Re: üzerine tıklayınca orjinal boyut
1*1 tablo yap, width %100 olsun, bu tablo içine resmini at, resmin width değerini %100 ver, sonra resme koyduğun a (a href dersem daha açıklayıcı olur sanırım) içinde onclick i kullanarak resmin büyük halde açılmasını sağla.
|
|
|
|
|
|
#3 (permalink) |
|
Üyelik Tarihi: 08.06.2007
Yer: Eskişehir
Mesaj: 32
|
Re: üzerine tıklayınca orjinal boyut
Anlatmak istediğim şöyle birşey :
Kod:
<script type="text/JavaScript">var actualWidth =1600 ;var actualHeight =1200; function scaleImg() { if (fitsInWindow()) return;what = document.getElementById('thepic'); if(what.width==tableWidth()) { what.width=actualWidth;what.height=actualHeight;displayWarning("none");} else {what.style.cursor = "pointer";what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;displayWarning("block");}} function liveResize() { if (fitsInWindow()) return;what = document.getElementById('thepic'); if (what.width!=actualWidth) { what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;displayWarning("block");}} function setImgWidth() { if (fitsInWindow())return;document.getElementById('thepic').width=tableWidth();displayWarning("block"); } function fitsInWindow() { if (actualWidth<tableWidth()) { displayWarning("none"); document.getElementById('thelink').removeAttribute('href'); return true; } else { document.getElementById('thelink').setAttribute('href','Fotoparked®|Resim Yükle'); return false; } } function tableWidth() { return windowWidth()-100;}function windowWidth() { if (navigator.appName=="Netscape") return window.innerWidth;return document.body.offsetWidth;} function displayWarning(how) {document.getElementById('scalewarning').style.display=how;}onresize=liveResize; </script> Js olarak yardımcı olabilir misiniz? |
|
|
|
|
|
#4 (permalink) |
|
Üyelik Tarihi: 14.10.2007
Yer: KOCAELİ
Mesaj: 391
|
Re: üzerine tıklayınca orjinal boyut
var actualWidth =1600 ;var actualHeight =1200;
sorun şurada sanırım. anlattığım gibi basit bir mantıkla yapın. js yi devreden çıkarıp dener misiniz bir? js konusunda o sorununuzu nasıl aşabileceğinizi şu an göremedim. |
|
|
|
|
|
#5 (permalink) |
|
Üyelik Tarihi: 08.06.2007
Yer: Eskişehir
Mesaj: 32
|
Re: üzerine tıklayınca orjinal boyut
Cevabı buldum mutlakabirilerinin işine yarar.
Kod:
<script type="text/JavaScript"> <!-- var origin_width=0; var max_width=800; function adjustImage(init) { if(document.getElementById("img_obj").width>max_width) { origin_width = document.getElementById("img_obj").width; document.getElementById("img_obj").width = max_width; document.getElementById("resized").style.display=''; } else if(document.getElementById("img_obj").width<=max_width) { if(init==1) origin_width = document.getElementById("img_obj").width; document.getElementById("img_obj").width = origin_width; document.getElementById("resized").style.display='none'; } } function autoResize(id){ var newheight; if(document.getElementById){ newheight=document.getElementById(id).contentWindow.document.body.scrollHeight; } document.getElementById(id).height= (newheight + 16) + "px"; } --> </script> <script type="text/JavaScript"> function showNullImg(obj) { //obj.src ="http://127.0.0.1/my/aihsdev/skin/default/thumb_icons/thumb_small.png"; //obj.width = obj.height = 100; return true; } function zoomimg(obj) { var zoom=parseInt(obj.style.zoom,10) || 100; zoom += event.wheelDelta / 24; imgW = obj.clientWidth*zoom/100; if (zoom>15 && imgW<1200) obj.style.zoom = zoom + "%"; return false; } </script> Burası da resminizin kaynağı Kod:
<img src="Kaynak resim" name="img_obj" border=0 id=img_obj onclick="adjustImage()" onmousewheel="zoomimg(this)" onload="adjustImage(1)" onerror="showNullImg(this)"/> Koaly gelsin. |
|
|
|
Zoque'a hoşgeldiniz!