Keyword

K2 breaking Morph accordions and tabs

  • Stian Didriksen
  • Stian Didriksen's Avatar Topic Author
  • Offline
  • New Member
More
14 years 4 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
});

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

More
14 years 4 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.

More
14 years 3 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.

More
14 years 3 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
};

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

More
14 years 3 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

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

  • Stian Didriksen
  • Stian Didriksen's Avatar Topic Author
  • Offline
  • New Member
More
14 years 3 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.

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

More
14 years 3 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.

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

More
14 years 3 months ago #76707 by Lefteris
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.


Powered by Kunena Forum