- Posts: 5
COMMUNITY FORUM
K2 breaking Morph accordions and tabs
- Stian Didriksen
- Topic Author
- Offline
- New Member
Less
More
14 years 11 months ago #76700
by Stian Didriksen
K2 breaking Morph accordions and tabs was created by Stian Didriksen
K2 have in its k2.js file, this call:
// Smooth Scroll
new SmoothScroll({
duration: 500
});
since there isn't passed a "links" parameter in there, all anchor links on the entire page gets attached to a SmoothScroll click event.
From the MooTools SmoothScroll source:
link.addEvent('click', function(event){
this.anchor = anchor;
this.toElement(anchor);
event.stop();
}.bindWithEvent(this));
as you can see, the events that are attached, are rendered inoperable, because of event.stop().
This is easily prevented by namespacing the links you want to scroll, with for example an "k2" or "k2-scroll" class.
for example:
// Smooth Scroll
new SmoothScroll({
duration: 500,
links: 'a.k2' //an alternate could be '.k2 a' to keep it cleaner
});
// Smooth Scroll
new SmoothScroll({
duration: 500
});
since there isn't passed a "links" parameter in there, all anchor links on the entire page gets attached to a SmoothScroll click event.
From the MooTools SmoothScroll source:
link.addEvent('click', function(event){
this.anchor = anchor;
this.toElement(anchor);
event.stop();
}.bindWithEvent(this));
as you can see, the events that are attached, are rendered inoperable, because of event.stop().
This is easily prevented by namespacing the links you want to scroll, with for example an "k2" or "k2-scroll" class.
for example:
// Smooth Scroll
new SmoothScroll({
duration: 500,
links: 'a.k2' //an alternate could be '.k2 a' to keep it cleaner
});
Please Log in or Create an account to join the conversation.
- FeSys
- Offline
- Elite Member
Less
More
- Posts: 262
14 years 11 months ago #76701
by FeSys
Replied by FeSys on topic K2 breaking Morph accordions and tabs
Thank you very much for your suggestion.. Really helpful "Stian Didriksen".
Please Log in or Create an account to join the conversation.
- Phil Snell
- Offline
- New Member
Less
More
- Posts: 3
14 years 10 months ago #76702
by Phil Snell
Replied by Phil Snell on topic K2 breaking Morph accordions and tabs
How can I get my click event back?? k2.js has removed it using SmoothScroll.
Please Log in or Create an account to join the conversation.
- Phil Snell
- Offline
- New Member
Less
More
- Posts: 3
14 years 10 months ago #76703
by Phil Snell
Replied by Phil Snell on topic K2 breaking Morph accordions and tabs
got a fix... use this on pages where you dont want the SmoothScroll...
SmoothScroll = function(){
return false
};
SmoothScroll = function(){
return false
};
Please Log in or Create an account to join the conversation.
- George Jones
- Offline
- New Member
Less
More
- Posts: 1
14 years 10 months ago #76704
by George Jones
Replied by George Jones on topic K2 breaking Morph accordions and tabs
Hey great find Phil, I'll be on for a while tonight, and if I don't catch you, I'll keep plugging away and catch up with you tomorrow. Thanks man,
George
George
Please Log in or Create an account to join the conversation.
- Stian Didriksen
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
14 years 9 months ago #76705
by Stian Didriksen
Replied by Stian Didriksen on topic K2 breaking Morph accordions and tabs
Bad idea Phil.
By doing that you'll break the "Scroll to top" functionality in templates like those from YOOtheme and RocketTheme.
As SmoothScroll is a Mootools native framework plugin.
By doing that you'll break the "Scroll to top" functionality in templates like those from YOOtheme and RocketTheme.
As SmoothScroll is a Mootools native framework plugin.
Please Log in or Create an account to join the conversation.
- Phil Snell
- Offline
- New Member
Less
More
- Posts: 3
14 years 9 months ago #76706
by Phil Snell
Replied by Phil Snell on topic K2 breaking Morph accordions and tabs
bad is relative
Stian Didriksen said:Bad idea Phil. By doing that you'll break the "Scroll to top" functionality in templates like those from YOOtheme and RocketTheme.
As SmoothScroll is a Mootools native framework plugin.
Stian Didriksen said:Bad idea Phil. By doing that you'll break the "Scroll to top" functionality in templates like those from YOOtheme and RocketTheme.
As SmoothScroll is a Mootools native framework plugin.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
14 years 9 months ago #76707
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic K2 breaking Morph accordions and tabs
Hi. Fixed for the next release. Added "k2Anchor" class to these anchors. Thanks for reporting this issue to us.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.