Welcome, Guest
Username: Password: Remember me

TOPIC: java script smooth12.js

java script smooth12.js 4 years 3 months ago #1585

hello everyone i want ask some question abotu this template,
i have make new module in top and also i want it move like left side always follow page, i found it in java script. here is the code :
//Document Javascript
window.addEvent('domready',function() {
	//Smooth Scroll when click on Elements on Window
	new Fx.SmoothScroll({ duration: 800 }, window); //800 milliseconds to get there
	
	//vars
	if(document.getElementById('mega_topleft') != null){
		var htopleft = document.getElementById('mega_topleft').offsetHeight;
	}else{
		var htopleft = 0;
	}
	
	if(document.getElementById('mega_logo') != null){
		var hlogo = document.getElementById('mega_logo').offsetHeight;
	}else{
		var hlogo = 0;
	}
	
	var menu = $('mega_leftmods'), offsetY = (htopleft + hlogo), offsetX = 0, speed = 500; 
	var setPosition = function(top) {
		var scroll = $(document.body).getScroll();
		if(scroll.y <= (htopleft + hlogo)){
			offsetY = (htopleft + hlogo) - scroll.y;
		}else if(scroll.y >= (htopleft + hlogo)){
			offsetY = 0;
		}
		menu.tween('top',scroll.y + offsetY);
	};
	//settings
	menu.set('tween',{ duration: speed }).setStyles({
		position: 'absolute',
		left: offsetX,
		top: offsetY,
		opacity: 1
	});
	//events
	window.addEvents({
		scroll: setPosition,
		load: setPosition
	});
});
and after that i find this one :
var menu = $('mega_leftmods'), offsetY = (htopleft + hlogo), offsetX = 0, speed = 500;
.
i want add new var menu ex. var menu = $('mega_new') so it will be
var menu = $('mega_new')+var menu = $('mega_leftmods'
.
how can i do this.
thanks before and this great template.
The administrator has disabled public write access.

Re: java script smooth12.js 4 years 3 months ago #1587

  • linh_omg
  • linh_omg's Avatar
  • OFFLINE
  • Moderator
  • Posts: 910
  • Thank you received: 568
  • Karma: 25
It may look like this:
- Add class for your new menu, eg: "myclass". Also add this class for current menu.
- You saw this:
var menu = $('mega_leftmods'), offsetY = (htopleft + hlogo), offsetX = 0, speed = 500;

Now instead of get the element by id ("mega_leftmods"), you can get elements by class ("myclass"). So you can apply for more than 1 menu.

That's the idea, certainly you may need work more after that.


Thanks
If you need to send us FTP access / host access, administrator access or any private information:
services(at)omegatheme(dot)com or drop a ticket www.omegatheme.com/member/
The administrator has disabled public write access.

Re: java script smooth12.js 4 years 3 months ago #1589

ok thanks ill try that one
The administrator has disabled public write access.
Time to create page: 0.163 seconds