Support » Themes and Templates » jQuery problem

  • Hey, I hope it’s good forum’s place…

    I wrote a jQuery script which runs on normal HTML site and I want to run it on WordPress. On my page I have running some other jQuery scripts, but I can’t properly change this one. Here is a code:

    $(document).ready(function () {
    
    	//Check if url hash value exists (for bookmark)
    	$.history.init(pageload);	
    
    	//highlight the selected link
    	$('a[href=' + document.location.hash + ']').addClass('selected');
    
    	//Seearch for link with REL set to ajax
    	$('a[rel=ajax]').click(function () {
    
    		//grab the full url
    		var hash = this.href;
    
    		//remove the # value
    		hash = hash.replace(/^.*#/, '');
    
    		//for back button
    	 	$.history.load(hash);	
    
    	 	//clear the selected class and add the class class to the selected link
    	 	$('a[rel=ajax]').removeClass('selected');
    	 	$(this).addClass('selected');
    
    	 	//hide the content and show the progress bar
    	 	$('#content_apl').hide();
    	 	$('#loading_apl').show();
    
    	 	//run the ajax
    		getPage();
    
    		//cancel the anchor tag behaviour
    		return false;
    	});
    });
    
    function pageload(hash) {
    	//if hash value exists, run the ajax
    	if (hash) getPage();
    }
    
    function getPage() {
    
    	//generate the parameter for the php script
    	var data = 'page=' + encodeURIComponent(document.location.hash);
    	$.ajax({
    		url: "xxx",
    		type: "GET",
    		data: data,
    		cache: false,
    		success: function (html) {	
    
    			//hide the progress bar
    			$('#loading_apl').hide();	
    
    			//add the content retrieved from ajax and put it in the #content div
    			$('#content_apl').html(html);
    
    			//display the body with fadeIn transition
    			$('#content_apl').fadeIn('slow');
    		}
    	});
    }
    
    function showLarge(srcLarge, srcRender)
    {
        document.getElementById("large").src = srcLarge;
    	document.getElementById("render").src = srcRender;
    	doGory();
    }
    
    function doGory()
    {
     $('html, body').animate({
     scrollTop: $("#wrapper_apl").offset().top
     }, 2000);
    }

    What it does:
    – able to change between 3 “sites” with content;
    – when clicking on one of pictures on one of those 3 sites u are getting up to the top of the page and 2 pictures are changing;

    If somebody can, please tell me exactly how to change it to work under the WordPress.

    Regards, K.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jQuery problem’ is closed to new replies.