| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| pirate Registriert seit: Nov 2005
Beiträge: 983
| Jquery History
Hi leute, ich hab folgendes Problem. Ich möchte das History Plugin von jQuery benutzen, aber es will einfahc nicht funktionieren. Wenn ich den Link klicke, ist der Hash in der adressleiste oben, aber am content ändert sich nichts. mach ich dann nen reload, funktionierts. also wird beim seiten laden die funktion "pageload" aufgerufen, aber nicht beim klick. ich verstehe aber absolut nicht warum. hat jemand ne ahnung? danke gruß Code: // 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) {
// hash doesn't contain the first # character.
if(hash) {
// restore ajax loaded state
alert("LOADING");
$("#load").load(hash + ".php");
} else {
// start page
$("#load").empty();
};
};
$(document).ready(function() {
$.history.init(pageload);
$(".startDiv").hide();
$(".startDiv2").hide();
$(".startDiv").fadeIn(400);
setTimeout(function() { $('.startDiv2').fadeIn(400); }, 1900);
$(".menuBt1").hover(
function(){
$(this).animate({
color: "#FBB03B",
}, 20 );
},
function() {
$(this).animate({
color: "#444444",
}, 600 );
});
//clicks
$("a[@rel='button']").click(function(){
//
var hash = this.href;
hash = hash.replace(/^.*#/, '');
// moves to a new page.
// pageload is called at once.
$.history.load(hash);
return false;
});
}); |
| | |
| | #2 (permalink) |
| pirate Registriert seit: Nov 2005
Beiträge: 983
|
Ich bin soweit, dass die funktion nun aufgerufen wird. aber die variable hash ändert sich nicht beim click sondern erst beim reload der page. das ist irgendwie komisch. Code: // 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) {
// hash doesn't contain the first # character.
if(hash) {
// restore ajax loaded state
alert("LOADING" + hash);
$("#load").load(hash + ".php");
} else {
// start page
alert("startpage" + hash);
$("#load").empty();
};
};
$(document).ready(function() {
$.history.init(pageload);
$(".startDiv").hide();
$(".startDiv2").hide();
$(".startDiv").fadeIn(400);
setTimeout(function() { $('.startDiv2').fadeIn(400); }, 1900);
$(".menuBt1").hover(
function(){
$(this).animate({
color: "#FBB03B",
}, 20 );
},
function() {
$(this).animate({
color: "#444444",
}, 600 );
});
//clicks
$("a[@rel='history']").click(function(){
//
var hash = this.href;
hash = hash.replace(/^.*#/, '');
// moves to a new page.
// pageload is called at once.
$.history.load(hash);
alert("klicked");
return false;
});
}); |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |
Ähnliche Themen | ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| [JQuery][JSTree] | Nightflyer | JavaScript & jQuery | 7 | 07-04-2010 23:10 |
| Jquery und CSS | michey | HTML und CSS | 5 | 24-03-2010 08:19 |
| [jQuery]Probleme mit IE | Nicmare | JavaScript & jQuery | 11 | 06-08-2009 07:35 |
| Problem mit jQuery | derkrebs | JavaScript & jQuery | 3 | 21-04-2008 16:35 |
| [jQuery] Problemchen | Nicmare | JavaScript & jQuery | 1 | 19-12-2007 12:55 |