Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2014, 08:28
edelegg
 
Fecha de Ingreso: marzo-2014
Mensajes: 1
Antigüedad: 10 años, 1 mes
Puntos: 0
Mensaje Ajustar imagen al tamaño de la pantalla

Hola, estoy intendo ver que estas 5 imágenes se ajusten en función al móvil que las quiera ver. Me refiero, si se ven desde un Galaxy S3 no es lo mismo que si se ven de un LG L5, digo por el tamaño de la pantalla.

¿Me puede ayudar alguien?


Código HTML:
Ver original
  1.     <title></title>
  2. </head>
  3. <p><script type="text/javascript">
  4.  
  5. // Flexible Image Slideshow- By JavaScriptKit.com (http://www.javascriptkit.com)
  6. // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
  7. // This notice must stay intact for use
  8.  
  9. var ultimateshow=new Array()
  10.  
  11. //ultimateshow[x]=["path to image", "OPTIONAL link for image", "OPTIONAL link target"]
  12.  
  13. ultimateshow[0]=['http://f.cl.ly/items/3F0T372I0l0E3i0U122F/skyblock.jpg', '', '']
  14. ultimateshow[1]=['http://f.cl.ly/items/1M310C2a2l1Q251D1J0P/survival.jpg', '', '']
  15. ultimateshow[2]=['http://f.cl.ly/items/2b1Z0y3y2B3q2q0F183J/bowwarfare.jpg', '', '']
  16. ultimateshow[3]=['http://f.cl.ly/items/2Z3W1F1v1n1L1o3Y2H33/pvp.jpg', '', '']
  17. ultimateshow[4]=['http://f.cl.ly/items/2K3n2P2A3D3S3r1y3v37/hg.jpg', '', '']
  18.  
  19. //configure the below 3 variables to set the dimension/background color of the slideshow
  20.  
  21. var slidewidth="100%" //set to width of LARGEST image in your slideshow
  22. var slideheight="100%" //set to height of LARGEST iamge in your slideshow
  23. var slidecycles="continous" //number of cycles before slideshow stops (ie: "2" or "continous")
  24. var randomorder="no" //randomize the order in which images are displayed? "yes" or "no"
  25. var preloadimages="yes" //preload images? "yes" or "no"
  26. var slidebgcolor='white'
  27.  
  28. //configure the below variable to determine the delay between image rotations (in miliseconds)
  29. var slidedelay=3000
  30.  
  31. ////Do not edit pass this line////////////////
  32.  
  33. var ie=document.all
  34. var dom=document.getElementById
  35. var curcycle=0
  36.  
  37. if (preloadimages=="yes"){
  38. for (i=0;i<ultimateshow.length;i++){
  39. var cacheimage=new Image()
  40. cacheimage.src=ultimateshow[i][0]
  41. }
  42. }
  43.  
  44. var currentslide=0
  45.  
  46. function randomize(targetarray){
  47. ultimateshowCopy=new Array()
  48. var the_one
  49. var z=0
  50. while (z<targetarray.length){
  51. the_one=Math.floor(Math.random()*targetarray.length)
  52. if (targetarray[the_one]!="_selected!"){
  53. ultimateshowCopy[z]=targetarray[the_one]
  54. targetarray[the_one]="_selected!"
  55. z++
  56. }
  57. }
  58. }
  59.  
  60. if (randomorder=="yes")
  61. randomize(ultimateshow)
  62. else
  63. ultimateshowCopy=ultimateshow
  64.  
  65. function rotateimages(){
  66. curcycle=(currentslide==0)? curcycle+1 : curcycle
  67. ultcontainer='<center>'
  68. if (ultimateshowCopy[currentslide][1]!="")
  69. ultcontainer+='<a href="'+ultimateshowCopy[currentslide][1]+'" target="'+ultimateshowCopy[currentslide][2]+'">'
  70. ultcontainer+='<img src="'+ultimateshowCopy[currentslide][0]+'" border="0">'
  71. if (ultimateshowCopy[currentslide][1]!="")
  72. ultcontainer+='</a>'
  73. ultcontainer+='</center>'
  74. if (ie||dom)
  75. crossrotateobj.innerHTML=ultcontainer
  76. if (currentslide==ultimateshow.length-1) currentslide=0
  77. else currentslide++
  78. if (curcycle==parseInt(slidecycles) && currentslide==0)
  79. return
  80. setTimeout("rotateimages()",slidedelay)
  81. }
  82.  
  83. if (ie||dom)
  84. document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')
  85.  
  86. function start_slider(){
  87. crossrotateobj=dom? document.getElementById("slidedom") : document.all.slidedom
  88. rotateimages()
  89. }
  90.  
  91. if (ie||dom)
  92. window.onload=start_slider
  93.  
  94. </script></p>
  95. </body>
  96. </html>



Como podéis ver:
Código Javascript:
Ver original
  1. var slidewidth="100%"
  2. var slideheight="100%"

Está ajustado al 100% pero pruebo a meterme desde el móvil y no se ajusta al tamaño sino que sale cortada porque sale muy grande.

¿QUÉ TAMAÑO TENDRÍA QUE PONER?

GRACIAS, de antemano, Edel.

Última edición por pzin; 16/03/2014 a las 08:30 Razón: formato código