View Full Version : Need Help please.

10-21-2007, 10:48 PM
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?


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; ?>;
border: 0px solid black;
padding: 1px;
visibility: hidden;
z-index: 100;

<div id="topbar">

<?php mosLoadModules ( 'floatbar' ); ?>

<script type="text/javascript">
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)

function staticbar(){
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.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
el.y -= startY;
return el;
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : iecompattest().scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
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");

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)

10-22-2007, 12:40 PM
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

10-22-2007, 02:17 PM
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.