TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Looking for a script (http://www.talkphp.com/javascript-ajax-e4x/2782-looking-script.html)

delayedinsanity 05-08-2008 06:58 PM

Looking for a script
 
Okay, Ajax is something I know very little to nothing about at this point. I know the basics, but I don't know javascript for a damn, so I'm hoping there's an open source script somewhere I can use.

I have two columns, set width, set height. Links in the first, text content in the second. I need something, using jquery, or mootools or completely standalone, I don't care, that'll let me click a link in the first column, and it will update the content in the second.

Anybody know where I can find this? Thank you in advance,
-m

buildakicker 05-08-2008 07:07 PM

Like this?

mootools demos - Ajax and More options

delayedinsanity 05-08-2008 07:39 PM

More like this, but preferably using jquery as I'm already using jquery's lightbox... sorry should've mentioned that. :-)
-m

delayedinsanity 05-08-2008 07:52 PM

Think I found what I needed..

freenity 05-08-2008 07:58 PM

ok so you have 2 columns:

HTML Code:

<div id="col1"></div>
<div id="col2"></div>

in column1 you will have this link: <a href="loadpage('info.php')">click me</a>

And before this (maybe just after the jquery.js include) you should make this function:

HTML Code:

function loadpage(page)
{
  $.get(page, function(data) {
                $('#col2').html(data);
              }
  );
}

This should work, as it gets info.php page and puts it's contents into #col2.

delayedinsanity 05-08-2008 08:24 PM

Seriously, it's that simple?

I haven't gotten to my Ajax class yet. That's ridiculous, haha.
-m

freenity 05-08-2008 08:26 PM

it's simple, that's using jquery. :)

Jim 05-08-2008 08:56 PM

I fix the problem like this in my websites:

Code:

// Vergroot div's hoogte wanneer een andere div hoger is
function changeDiv() {
       
        // Div's hoogte's
        var contentDiv    = document.getElementById('mainContent');
        var contentHeight = document.getElementById('mainContent').offsetHeight;
        var browserWindow = document.documentElement;       
        var menuDiv      = document.getElementById('menu');
       
        // Client window
        var clientWindowHeight = browserWindow.clientHeight - 130;
       
        // Grootste hoogte?
        var size = Math.max(clientWindowHeight, contentHeight);
       
        // Set height
        //contentDiv.style.height = size+'px';
        //menuDiv.style.height = size+'px';
       
}

window.onload = changeDiv;
window.onresize = changeDiv;

Should be pretty simple even while the comment is in dutch (since im dutch)

The place where you see -130, is my height of the header. I design my sites like this:

- overall wrapper with optional BG

- header

- col 1
- col 2

- close wrapper

If you choose to use my code and dont get it, don't hestitate mailing me (jim at combined-minds.net)


All times are GMT. The time now is 05:13 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0