normal java script smooth12.js

More
11 years 9 months ago #1585 by clarck connect
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 :
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 :
Code:
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
Code:
var menu = $('mega_new')+var menu = $('mega_leftmods'
.
how can i do this.
thanks before and this great template.

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #1587 by Linh Robert
It may look like this:
- Add class for your new menu, eg: "myclass". Also add this class for current menu.
- You saw this:
Code:
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 Notice: Undefined variable: target in /home/omegatheme/public_html/components/com_kunena/template/aurelia/layouts/bbcode/url/default.php on line 32
> www.omegatheme.com/member/

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #1589 by clarck connect
ok thanks ill try that one

Please Log in or Create an account to join the conversation.

Time to create page: 0.277 seconds

About Growth

Innovative tech for eCommerce growth

Contact Info

Head: No. 3, 175/55 Lane, Lac Long Quan St., Nghia Do Ward, Cau Giay District, Hanoi City, Vietnam