Results 1 to 3 of 3

Thread: Need Help please.

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Need Help please.

    Hi there, I am looking for a little help as I am not too familiar with Javascript.

    I had a module for Joomla which allows a user to assign a module within this one and makes that module scroll up and down the screen as the users moves the page up or down. It also allows the user to set a variable as x and y to specify the exact position this occurs.

    I want to keep the positioning but eliminate the movement... can anyone take a look at this code and give me their two cents?

    Thanks,
    James

    Code:
    <?php
    /*
    Created using the Mambo Addon Wizard - http://www.PunkSoftware.com
    *@ floatin_mod
    *@ Package floatin_mod
    *@ (C) 2006 Shawn Sandy
    *@ Copyright 2006 - Shawn Sandy
    *@ version 1.0
    */
    
    defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
    
    // Retreive parameters
    $width = $params->get( 'width', '225' );
    $height = $params->get( 'two', '150' );
    $bgcolor = $params->get( 'bgcolor', '#f5f5f5' );
    $closeimage = $params->get( 'closeimage', 'default.img' );
    $persistclose = $params->get( 'persistclose');
    $startx = $params->get ( 'startx');
    $starty = $params->get ('starty');
    ?>
    
    <style type="text/css" media="all">
    #<?php echo "topbar"; ?>{
    	width:<?php echo $width; ?>;
    	height:<?php echo $height; ?>;
    	bgcolor:<?php echo $bgcolor; ?>;
    	position:absolute;
    	border: 0px solid black;
    	padding: 1px;
    	visibility: hidden;
    	z-index: 100;
    }
    </style>
    
    <div id="topbar">
    
    <?php mosLoadModules ( 'floatbar' ); ?>
    </div>
    
    
    <script type="text/javascript">
    <?php
    echo "var persistclose= 0 \n"; //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
    echo "var startX = $startx \n"; //set x offset of bar in pixels
    echo "var startY = $starty \n"; //set y offset of bar in pixels
    echo "var verticalpos=\"fromtop\"";
    ?>
    
    /***********************************************
    * Floating Top Bar script- © Dynamic Drive (www.dynamicdrive.com)
    * Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
    
    function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset);
    if (end == -1) end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }
    
    function closebar(){
    if (persistclose)
    document.cookie="remainclosed=1"
    document.getElementById("topbar").style.visibility="hidden"
    }
    
    function staticbar(){
    	barheight=document.getElementById("topbar").offsetHeight
    	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
    	var d = document;
    	function ml(id){
    		var el=d.getElementById(id);
    		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
    		el.style.visibility="visible"
    		if(d.layers)el.style=el;
    		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
    		el.x = startX;
    		if (verticalpos=="fromtop")
    		el.y = startY;
    		else{
    		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
    		el.y -= startY;
    		}
    		return el;
    	}
    	window.stayTopLeft=function(){
    		if (verticalpos=="fromtop"){
    		var pY = ns ? pageYOffset : iecompattest().scrollTop;
    		ftlObj.y += (pY + startY - ftlObj.y)/8;
    		}
    		else{
    		var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
    		ftlObj.y += (pY - startY - ftlObj.y)/8;
    		}
    		ftlObj.sP(ftlObj.x, ftlObj.y);
    		setTimeout("stayTopLeft()", 10);
    	}
    	ftlObj = ml("topbar");
    	stayTopLeft();
    }
    
    if (window.addEventListener)
    window.addEventListener("load", staticbar, false)
    else if (window.attachEvent)
    window.attachEvent("onload", staticbar)
    else if (document.getElementById)
    window.onload=staticbar
    </script>
    Last edited by gamersspace; 10-21-2007 at 11:11 PM.

  2. #2
    Join Date
    Jan 2006
    Location
    Stephen Island Australia (QLD)
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    im not to sure what you mean mate? you want the screen to move up and down, but only when the user specifies and x and y chord..?
    I think you need to give a little more detail im just having a bit of trouble undersatnding the question?
    thanks mate

  3. #3
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I apologize, I may have been a bit vague.

    Are you familiar with Joomla? It is a CMS based on Module Positions. This code is from a Module which allows you to specify an X and Y axis within its parameters to position a second Module. The second Module is then positioned in that set point and scrolls up and down the page as the user scrolls the page. I want to eliminate the scroll part in the JavaScript and make the Second Module static and remain in the same spot no matter what.

    I just don't know how to change the Java to tell it to stop moving up and down.

    This code is based on the Floating Top Bar Script.

    James

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •