Ver Mensaje Individual
  #5 (permalink)  
Antiguo 02/03/2013, 19:15
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Iframe a parte especifica

Efectivamente. como señala @Bonez, con javascript

Algo asi

index.html

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es-ar">
  3. <meta charset="utf-8" />
  4. <title>scroll to en iframe desde parent</title>
  5. </head>
  6. <p><button onclick="document.getElementById('iframescroll').contentWindow.scrollWindow(1600,500);">ir a posición 1600,500</button>
  7. <br />
  8. <button onclick="document.getElementById('iframescroll').contentWindow.scrollWindow(500,300);">ir a posición 500,300</button>
  9. </p>
  10. <iframe src="scrollto.html" id="iframescroll" width="500" height="200" style="overflow: hidden; border: solid 1px #000;">
  11. </body>
  12. </html>

scollto.html (src del iframe)
Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es-ar">
  3. <meta charset="utf-8" />
  4. <title>scrollTo en iframe</title>
  5. <style type="text/css">
  6. /*<![CDATA[*/
  7. html, body{
  8. padding: 0;
  9. margin: 0;
  10. border: none;
  11. height: 2000px
  12. width: 2000px;
  13. }
  14. div#test{
  15. position: absolute;
  16. left: 1600px;
  17. top: 500px;
  18. width: 100px;
  19. height: 40px;
  20. background: lime;
  21. margin: 0;
  22. }
  23.  
  24. div#test2{
  25. position: absolute;
  26. left: 500px;
  27. top: 300px;
  28. width: 100px;
  29. height: 40px;
  30. background: red;
  31. margin: 0;
  32. }
  33. /*]]>*/
  34. function scrollWindow(x,y){
  35. window.scrollTo(x,y);
  36. }
  37. </head>
  38. <div id="test">
  39.     1600,500
  40. </div>
  41. <div id="test2">
  42.     500,300
  43. </div>
  44. </body>
  45. </html>

Es decir, definis la función en el iframe que usa el método scrollTo() y le pasás los valores desde el parent

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.