Autor | Zpráva | ||
---|---|---|---|
Karol Profil * |
#1 · Zasláno: 28. 7. 2012, 00:26:49
Dobrý deň potrebujem dať na stránku hudbu tak ak sa prekliknem na inú podstránku bude pokračovať tam kde skončila a nepôjde od začiatku ako to mam vyriešiť? nejaké návrhy alebo niečo? Ďakujem
|
||
margin Profil * |
#2 · Zasláno: 28. 7. 2012, 09:32:49
|
||
Karol Profil * |
#3 · Zasláno: 28. 7. 2012, 09:59:42
veľa ľudí ma blokované ďalšie okno takto nie niečo ako ajax ale vôbec neviem ako to funguje
|
||
margin Profil * |
#4 · Zasláno: 28. 7. 2012, 10:26:24
Karol:
„veľa ľudí ma blokované ďalšie okno“ Skoro všichni blokují nevyžádaná okna, je to výchozí nastavení prohlížečů. Nové okno otevírané kliknutím na odkaz v HTML nebo JS neblokuje skoro nikdo. Taky už můžu tvrdit, že spousta lidí má blokovaný JavaScript a proto AJAX ne. |
||
Karol Profil * |
#5 · Zasláno: 28. 7. 2012, 12:11:46
Takže urobil som si to v ajaxe no ale mám v obsahu JS galeriu ak sa načíta prvý krát stránka tak ide všetko okey no ale ak prepnem obsah na iný obsah (v druhom obsahu je tiež ta istá galéria) tak už JS nefunguje.
Kody: content: <?php function doIt($it) { switch ($it) { case "one": return ' <div class="picture-slides-container"> <div class="picture-slides-fade-container"> <a class="picture-slides-image-link"> <span class="picture-slides-image-load-fail">The image failed to load:</span> <img class="picture-slides-image" src="foto/home/f1.jpg"/> </a> </div> <div class="navigation-controls"> <a href="index.html" class="picture-slides-previous-image"><img src="css/prew.png" alt""></a> <a href="index.html" class="picture-slides-next-image"><img src="css/next.png" alt""></a> <a href="index.html" class="picture-slides-start-slideshow"><img src="css/play.png" alt""></a> <a href="index.html" class="picture-slides-stop-slideshow"><img src="css/stop.png" alt""></a> </div> </div> '; break; case "two": return ' <div class="picture-slides-container"> <div class="picture-slides-fade-container"> <a class="picture-slides-image-link"> <span class="picture-slides-image-load-fail">The image failed to load:</span> <img class="picture-slides-image" src="foto/home/f2.jpg"/> </a> </div> <div class="navigation-controls"> <a href="index.html" class="picture-slides-previous-image"><img src="css/prew.png" alt""></a> <a href="index.html" class="picture-slides-next-image"><img src="css/next.png" alt""></a> <a href="index.html" class="picture-slides-start-slideshow"><img src="css/play.png" alt""></a> <a href="index.html" class="picture-slides-stop-slideshow"><img src="css/stop.png" alt""></a> </div> </div> '; break; case "three": return ' <div class="picture-slides-container"> <div class="picture-slides-fade-container"> <a class="picture-slides-image-link"> <span class="picture-slides-image-load-fail">The image failed to load:</span> <img class="picture-slides-image" src="foto/home/f2.jpg"/> </a> </div> <div class="navigation-controls"> <a href="index.html" class="picture-slides-previous-image"><img src="css/prew.png" alt""></a> <a href="index.html" class="picture-slides-next-image"><img src="css/next.png" alt""></a> <a href="index.html" class="picture-slides-start-slideshow"><img src="css/play.png" alt""></a> <a href="index.html" class="picture-slides-stop-slideshow"><img src="css/stop.png" alt""></a> </div> </div> '; break; } } if (isset($_GET['content'])) { $content=$_GET['content']; $show=doIt($content); } elseif (isset($_GET['showit'])) { $showit=$_GET['showit']; echo doIt($showit); } else { echo doIt('one'); } ?> script: var request = false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { request = false; } } @end @*/ if (!request && typeof XMLHttpRequest != 'undefined') { request = new XMLHttpRequest(); } function ajaxSwitch(content) { /*the name of your page with the content goes here */ var url = "ajaxcontent.php?showit=" + escape(content); request.open("GET", url, true); request.onreadystatechange = go; request.send(null); } function go() { if (request.readyState == 4) { if (request.status == 200) { var response = request.responseText; /* 'ajaxcontent' is the name of my div that will contain the info */ document.getElementById("ajaxcontent").innerHTML = response; } } } function showIt() { var aTags=document.getElementById('options').getElementsByTagName('a'); for (i=0; i<aTags.length; i++) { aTags[i].onclick=function() { var show=this.href.split('content=')[1]; ajaxSwitch(show); return false; } } } window.onload=showIt; index: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="./css/basic.css" type="text/css" /> <link rel="stylesheet" href="css/picture-slides.css" type="text/css"> <script type="text/javascript" src="./js/jquery.min.js"></script> <script type="text/javascript" src="./js/PictureSlides-jquery-2.0.js"></script> <script type="text/javascript" src="./ajaxswitch.js"></script> <script type="text/javascript" src="./js/home.js"></script> <style type="text/css"> body { background-color: #000; } </style> <link href="layout.css" rel="stylesheet" type="text/css" /> <script src="./SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="./SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="ajaxswitchcontent"> <div class="wrap"> <div class="head"> <div id="logo"> <img src="images/logo.png" width="201" height="91" alt="Jozef Bibel Photography" /> </div> <div class="head_nav"> <div class="navigation_holder"> <ul id="options"> <ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="#" onclick="ajaxSwitch('one'); return false"></a><img src="./img/menu/home.png" alt="Home" onmouseover="this.src='./img/menu/home2.png'" onmouseout="this.src='./img/menu/home.png'"/></li> <li><a href="about.html">About</a></li> <li><a href="wedding.html" class="MenuBarItemSubmenu">Wedding</a> <ul> <li><a href="portrait.html">Portrait</a></li> <li><a href="documentary.html">Documentary</a></li> <li><a href="details.html">Details</a></li> </ul> </li> <li><a href="ajaxswitch.php?content=one">Babies</a></li> <li><a href="ajaxswitch.php?content=two">Prices</a></li> <li><a href="ajaxswitch.php?content=three">Contact</a></li> </ul> </ul> </div> </div> </div> <div id="ajaxcontent"> <?php include 'ajaxcontent.php'; echo $show; ?> </div> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryMenuBarDownHover.gif", imgRight:"SpryMenuBarRightHover.gif"}); var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgRight:"SpryMenuBarRightHover.gif"}); //--> </script> <embed src="./song.mp3" width="50" height="25" autostart="true" repeat="true"> </div> </div> </body> </html> viete mi povedať prečo? |
||
weroro Profil |
#6 · Zasláno: 28. 7. 2012, 15:22:46
Karol:
„potrebujem dať na stránku hudbu tak ak sa prekliknem na inú podstránku bude pokračovať tam kde skončila a nepôjde od začiatku“ LocalStorage v JS |
||
Keeehi Profil |
#7 · Zasláno: 28. 7. 2012, 17:32:25
Co takhle dodat odkaz na živou ukázku. Ten kód v [#5] nikdo zkoumat nebude.
|
||
Karol Profil * |
#8 · Zasláno: 28. 7. 2012, 19:50:22
Posledne odkazy sú cez ajax (Babies, Prices, Contact) http://e-solutions.6f.sk/a/ajaxswitch.php
ak načitate prvý krát stránku tak to ide ako má no ak sa prekliknete na prices tak je tam ten istý k´d v contente a nejde to a ani potom ak sa vrátite na babies. |
||
Keeehi Profil |
#9 · Zasláno: 28. 7. 2012, 21:27:17
Karol:
Nějak nevidím ten problém. Mohl by jsi to popsat nějak podrobněji nebo jinak? |
||
Monkeys Profil * |
#10 · Zasláno: 28. 7. 2012, 23:17:44
Hudba na stranke je iba otrava, nepoviem este na Flashovom template tam to pasuje ale po 3 vypocuti hladam Volume off.
|
||
Karol Profil * |
#11 · Zasláno: 29. 7. 2012, 14:02:45
hudbu nerieš no ak si otvoriš web obrázky sa ti začnu meniť fade out efekt no ak prepneš si stánku tak už zmiznu aj tlašitka na presuvanie obrázkov a nejde ten efeket a nefunguje cely script.
|
||
Keeehi Profil |
#12 · Zasláno: 29. 7. 2012, 17:15:41
Karol:
Začal bych tím, že bych vyhodil ty scripty mimo #ajaxcontent .
Navíc ten ajax není moc dobrý. Upravte si třeba tento. |
||
Časová prodleva: 12 let
|
0