Jquery Resizable Issue

Posted by MrEnder on Stack Overflow See other posts from Stack Overflow or by MrEnder
Published on 2010-03-20T05:31:36Z Indexed on 2010/03/20 5:41 UTC
Read the original article Hit count: 591

Filed under:
|
|

Ok my windows are supposed to be resizable...

the web site is

http://opentech.durhamcollege.ca/~intn2201/brittains/labs/

my code is

document.writeln('<object id="cursorObj" width="0" height="0" >');
document.writeln('<param name="movie" value="flash/cursor.swf" name="wmode" value="transparent">');
document.writeln('<embed id="cursorEmbed" src="flash/cursor.swf" width="0" height="0" style="position: absolute;" wmode="transparent">');
document.writeln('</embed>');
document.writeln('</object>');*/

var browser=navigator.appName;
var frameWidth = "";
var frameHeight = "";
var d = new Date();
var year = d.getFullYear();
var date = "";
var menuCheck = false;
var si = "";
var io = "";
var windowT = "";
var cursorObj = "";
var cursorEmbed = "";
var windowState = false;
var windowBody = "";

var bgImage_JS = document.getElementById("bgImage");
var desktop_JS = document.getElementById("desktop");
var menuBar_JS = document.getElementById("menuBar");
var menuBarButton_JS = document.getElementById("menuBarButton");
var menuBarContainer_JS = document.getElementById("menuBarContainer");
var menuBarClock_JS = document.getElementById("menuBarClock");
var action1_JS = document.getElementById("action1");
var action2_JS = document.getElementById("action2");
var action3_JS = document.getElementById("action3");
var showdesktopButton_JS = document.getElementById("menuBarButtonShowdesktopInput");
var windowExitImage_JS = document.getElementById("windowExitImage");

/*if(browser!="Netscape") {

    windowExitImage_JS.style.top = "-25px";

}*/

function requestWindow(url) {

    if(windowState==false) {
        windowOpen();
        requestWindowInput()
    }
    else if(windowState==true) {
        windowClose();
    }

    if (window.XMLHttpRequest) {
        xmlhttp=new XMLHttpRequest();
    }

    else {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET",url,false);
    xmlhttp.send(null);


}
function requestWindowInput() {

    document.getElementById('action1').innerHTML=xmlhttp.responseText;

}

function requestdesktop(url) {

    if (window.XMLHttpRequest) {
        xmlhttp=new XMLHttpRequest();
    }

    else {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.open("GET",url,false);
    xmlhttp.send(null);
    document.getElementById('desktop').innerHTML=xmlhttp.responseText;

}

requestdesktop('desktop.php');

function reset() {

    if (self.innerWidth) {
        frameWidth = self.innerWidth;
        frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth) {
        frameWidth = document.documentElement.clientWidth;
        frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body) {
        frameWidth = document.body.clientWidth;
        frameHeight = document.body.clientHeight;
    }

    /*cursorObj = document.getElementById("cursorObj");
    cursorEmbed = document.getElementById("cursorEmbed");*/

    if(browser!="Netscape") {

        bgImage_JS.style.top = 8 + "px";
        bgImage_JS.style.left = 8 + "px";
        desktop_JS.style.top = 8 + "px";
        desktop_JS.style.left = 8 + "px";
        menuBar_JS.style.top = (frameHeight - 45) + "px";
        menuBar_JS.style.left =  8 + "px";
        desktop_JS.style.width = "24px";

    }

    bgImage_JS.style.width = (frameWidth - 21) + "px";
    bgImage_JS.style.height = (frameHeight - 51) + "px";
    desktop_JS.style.width = (frameWidth - 20) + "px";
    desktop_JS.style.height = (frameHeight - 50) + "px";
    menuBar_JS.style.width = (frameWidth - 20) + "px";
    menuBar_JS.style.top = (frameHeight - 40) + "px";
    menuBarClock_JS.style.left = (frameWidth - 100) + "px";
    /*cursorEmbed.style.width = (frameWidth - 20) + "px";
    cursorEmbed.style.height = (frameHeight - 20) + "px";
    cursorEmbed.style.width = (frameWidth - 20) + "px";
    cursorEmbed.style.height = (frameHeight - 20) + "px";*/
    t=setTimeout('reset()',500);

}

function menuSize() {


    action3_JS.style.backgroundColor = "black";
    action3_JS.style.color = "#C0C0FF";
    action3_JS.style.border = "1px solid #C0C0FF";
    action3_JS.style.width = "250px";
    action3_JS.style.height = "400px";
    action3_JS.style.padding = "5px";

    if(browser!="Netscape") {

        action3_JS.style.top = (frameHeight - 452) + "px";
        var winCheck = frameWidth - 1651;
        if(winCheck<=0) {

            action3_JS.style.left = 8 + "px";

        }
        else {

            action3_JS.style.left = (frameWidth - 1672) + "px";

        }

    }
    else {

        action3_JS.style.top = (frameHeight - 452) + "px";
        var winCheck = frameWidth - 1672;
        if(winCheck<=0) {

            action3_JS.style.left = 8 + "px";

        }
        else {

            action3_JS.style.left = (frameWidth - 1672) + "px";

        }

    }

    //menuT=setTimeout('menuSize()',500);

}
function menu() {

    if(menuCheck==false) {

        var lab1 = "'lab1.php'";
        var lab2 = "'lab2.php'";
        var lab3 = "'lab3.php'";
        var lab4 = "'lab4.php'";
        var lab5 = "'lab5.php'";
        var lab6 = "'lab6.php'";
        menuSize();
        action3_JS.innerHTML = '<input type="button" class="menuButtons" id="menuButton1" value="Lab1" onclick="requestWindow(' + lab1 + ')" /><input type="button" class="menuButtons" id="menuButton2" value="Lab2" onclick="requestWindow(' + lab2 + ')" /><input type="button" class="menuButtons" id="menuButton3" value="Lab3" onclick="requestWindow(' + lab3 + ')" /><input type="button" class="menuButtons" id="menuButton4" value="Lab4" onclick="requestWindow(' + lab4 + ')" /><input type="button" class="menuButtons" id="menuButton5" value="Lab5" onclick="requestWindow(' + lab5 + ')" /><input type="button" class="menuButtons" id="menuButton6" value="Lab6" onclick="requestWindow(' + lab6 + ')" /><input type="button" class="menuButtons" id="menuButtonShowdesktop" value="Show desktop" onclick="showDesktop()" />';
        menuCheck=true;

    }
    else if(menuCheck==true) {

        action3_JS.style.backgroundColor = "transparent";
        action3_JS.style.border = "0px solid #C0C0FF";
        action3_JS.style.width = "0px";
        action3_JS.style.height = "0px";
        action3_JS.style.padding = "0px";
        action3_JS.style.top = "0px";
        action3_JS.style.left = "0px";
        action3_JS.innerHTML = "";
        //window.clearTimeout(menuT);
        menuCheck=false;

    }

}

function clearMenu() {

    action3_JS.style.backgroundColor = "transparent";
    action3_JS.style.border = "0px solid #C0C0FF";
    action3_JS.style.width = "0px";
    action3_JS.style.height = "0px";
    action3_JS.style.padding = "0px";
    action3_JS.style.top = "0px";
    action3_JS.style.left = "0px";
    action3_JS.innerHTML = "";
    menuCheck=false;
    //menuT=setTimeout('clearMenu()',500);

}
function showDesktop() {

    clearMenu();
    action1_JS.style.display = "none";
    action1_JS.style.backgroundColor = "transparent";
    action1_JS.style.border = "0px solid #C0C0FF";
    action1_JS.style.width = 0 + "px";
    action1_JS.style.height = 0 + "px";
    action1_JS.style.left = 0 + "px";
    action1_JS.style.top = 0 + "px";
    window.clearInterval(si);
    window.clearTimeout(windowT);
    windowState = false;

}
function windowSize() {

    action1_JS.style.backgroundColor = "black";
    action1_JS.style.color = "#C0C0FF";
    action1_JS.style.border = "1px solid #C0C0FF";
    action1_JS.style.width = (frameWidth - 375) + "px";
    action1_JS.style.height = (frameHeight - 200) + "px";
    action1_JS.style.left = (frameWidth - 1500) + "px";
    var winCheck1 = (frameWidth - 1500);
    if(winCheck1<=0) {

        action1_JS.style.left = (frameWidth - 850) + "px";

    }
    winCheck1 = (frameWidth - 850);
    if(winCheck1<=0) {

        action1_JS.style.left = (frameWidth - 300) + "px";
        action1_JS.style.width = (frameWidth - 50) + "px";

    }
    action1_JS.style.top = (frameHeight - 750) + "px";
    var winCheck2 = (frameHeight - 750);
    if(winCheck2<=0) {

        action1_JS.style.top = (frameHeight - 500) + "px";

    }
    //windowT=setTimeout('windowSize()',500);

    $(function() {
        $("#action1").resizable();
    });

}



function windowOpen() {

    windowSize();

    action1_JS.style.display = "none";

    $("#action1").fadeIn(1300);

    setTimeout("requestWindowInput()", 100);

    windowState = true;

    clearMenu();

}

function windowClose() {

    action1_JS.style.display = "";

    $("#action1").fadeOut(1300);

    windowState = false;

    clearMenu();

    setTimeout("windowOpen()", 1350);

}

function windowDragStart() {

    $(function() {$("#action1").draggable( {disabled: false} );});

}
function windowDragEnd() {

    $(function() {$("#action1").draggable( {disabled: true} );});

}
function windowExitMouseover() {

   document.getElementById("windowExitImage").src = "images/exit2.png";

}
function windowExitMouseout() {

   document.getElementById("windowExitImage").src = "images/exit1.png";

}

$(function() {
        $("#action1").resizable();
    });

I'm trying to use

$(function() {
        $("#action1").resizable();
    });

to resize my #action1 div

sorry for the long code =[ not sure whats breaking it is why I sent everything

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX