Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> imgbox + history jquery = nie działa
Derwu
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 2.11.2003

Ostrzeżenie: (10%)
X----


Witam ponownie,

kolejny problem.

Używam pluginy do jQuery:

1. history http://www.mikage.to/jquery/jquery_history_xhtml.html#aao
2. imgbox http://jqueryglobe.com/article/imgbox

Gdy użyję tylko imgbox'a działa bez zarzutów, gdy użyję tylko history też działa ok, natomiast jeżeli probuję wykorzystać oba pluginy, nie działa ani imgbox, ani history.

Wygląda to wszystko tak i działać nie chce w takiej konfiguracji
CODE
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="imgbox/jquery.imgbox.pack.js"></script>
<link rel="stylesheet" href="imgbox/imgbox.css" />


<script type="text/javascript">
$(document).ready(function() {
$("a.galeria").imgbox();

});
</script>




<script type="text/javascript" src="js/jquery.history.js"></script>
<script type="text/javascript">
// PageLoad function
// This function is called when:
// 1. after calling $.historyInit();
// 2. after calling $.historyLoad();
// 3. after pushing "Go Back" button of a browser
function pageload(hash) {
if (!isNaN(hash)){
var url = "get.php?id="+ escape(hash) + "&language=<?php echo $language?>";
}
else {
if(hash!='szukaj'){
var url = "get.php?show_realizacje="+ escape(hash).replace('realizacja', '') + "&language=<?php echo $language?>";
}
else if (hash=='szukaj') {
var url = "get.php?search="+ document.forms[0].search.value +"&language=<?php echo $language?>";
}
}
if(hash) {
$("#tresc").load(url);
}
}

$(document).ready(function(){
// Initialize history plugin.
// The callback is called at once by present location.hash.
$.historyInit(pageload, "get.php?id=33&language=<?php echo $language?>");

// set onlick event for buttons
$("a[rel='menu']").click(function(){
//
var hash = this.href;
hash = hash.replace(/^.*#/, '');
// moves to a new page.
// pageload is called at once.
// hash don't contain "#", "?"
$.historyLoad(hash);
return false;
});
});
</script>


Proszę o pomoc.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Derwu
post
Post #2





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 2.11.2003

Ostrzeżenie: (10%)
X----


Dzięki za zwrócenie uwagi co do nagłówków, get.php wypisuje teraz tylko treść.

Użyłem pluginu livequery w taki sposób jak poniżej, ale nadal nie działa, gdy włączony jest plugin history
  1. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
  2. <script src="js/jquery.livequery.js" type="text/javascript" charset="utf-8"></script>
  3. <script type="text/javascript" src="js/jquery.history.js"></script>
  4. <script type="text/javascript" src="imgbox/jquery.imgbox.pack.js"></script>
  5. <link rel="stylesheet" href="imgbox/imgbox.css" />

[JAVASCRIPT] pobierz, plaintext
  1.  
  2. <script type="text/javascript">
  3. // PageLoad function
  4. // This function is called when:
  5. // 1. after calling $.historyInit();
  6. // 2. after calling $.historyLoad();
  7. // 3. after pushing "Go Back" button of a browser
  8. function pageload(hash) {
  9. if (!isNaN(hash)){
  10. var url = "get.php?id="+ escape(hash) + "&language=<?php echo $language?>";
  11. } else {
  12. if(hash!='szukaj'){
  13. var url = "get.php?show_realizacje="+ escape(hash).replace('realizacja', '') + "&language=<?php echo $language?>";
  14. } else if (hash=='szukaj') {
  15. var url = "get.php?search="+ document.forms[0].search.value +"&language=<?php echo $language?>";
  16. }
  17. }
  18. if(url) {
  19. $("#tresc").load(url);
  20. }
  21. }
  22.  
  23. $(document).ready(function() {
  24. // Initialize history plugin.
  25. // The callback is called at once by present location.hash.
  26. $.historyInit(pageload, "get.php?id=33&language=<?php echo $language?>");
  27. // set onlick event for buttons
  28. $("a[rel='menu']").click(function(){
  29. var hash = this.href;
  30. hash = hash.replace(/^.*#/, '');
  31. // moves to a new page.
  32. // pageload is called at once.
  33. // hash don't contain "#", "?"
  34. $.historyLoad(hash);
  35. return false;
  36. });
  37.  
  38. $("a.galeria").imgbox();
  39. $('a.galeria')
  40. .livequery('click', function(event) {
  41. imgbox();
  42. });
  43. });
  44.  
  45. </script>
[JAVASCRIPT] pobierz, plaintext


Ten post edytował Derwu 3.12.2009, 16:21:49
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 00:45