View Full Version : jQuery simple fade effect problem!?

10-07-2010, 01:55 AM
this is my first jQuery try - I tried a simple content fade in fade out effect for my Joomla Template.

heres some code:

$(function() {

var newHash = "",
$mainContent = $("#main-content"),
$pageWrap = $("#wrapper"),
baseHeight = 0,

baseHeight = $pageWrap.height() - $mainContent.height();

$("nav").delegate("a", "click", function() {

window.location.hash = $(this).attr("href");

return false;

$(window).bind('hashchange', function(){

newHash = window.location.hash.substring(1);

if (newHash) {
.fadeOut(200, function() {
$mainContent.hide().load(newHash + " #guts", function() {
$mainContent.fadeIn(200, function() {
height: baseHeight + $mainContent.height() + "px"
$("nav a").removeClass("current");
$("nav a[href="+newHash+"]").addClass("current");





the script works but the problem is that after I click in my navigation I get a link like:


And I want:

so I tried to change the window location to:
window.location.hash = $(this).attr('href').substr(0,$(this).lastIndexOf('/') + 1);

that works but - now the effect don't work!?? :confused:

hope someone can help me out with that - thanks!

10-07-2010, 02:03 AM
Change back to what you originally had to start off with, the one where you didn't want it to link. Now create a php file named index. Place this coding in the file:

Header ( 'Location:http://mypage.com/workspace/joomla/news/' );

Probably the most simplest way since you haven't posted all the coding.

10-07-2010, 03:05 AM
thanks but that don't really helps because - everything works, it's not linked to the wrong address - the js just creates the wrong url in the browser. If I move back to the start page - I get this url:


so - if I use this:

window.location.hash = $(this).attr('href').substr(0,$(this).lastIndexOf('/') + 1);

the urls are like how I want them - but then the jquery effect don't works - !?

any other ideas??


10-07-2010, 03:30 PM
..can't find my mistake - if someone has an idea that would be nice.. thanks