Post by Neuron on Apr 15, 2015 1:25:10 GMT -8
I've tried to use some jQuery plugins to add smooth scrolling in the forum wrapper, so that users who browse with Chrome can have a smooth scrolling experience without installing 3rd party extensions.
All went well, I was able to enable smooth scrolling, but after I managed to do so, I noticed some things stopped working on the site. The WYSISYG post editor couldn't switch anymore from BBCode to Preview and if you wrote some text in it and pressed the Reply button, it failed to get posted. Instead, it discarded the text and reported you didn't write any text in your post.
After disabling the plugins loaded for smooth scrolling, posting started working again.
These are the JS files I linked in the forum wrapper:
TweenLite and ScrollToPlugin
This is the JS code I used to configure smooth scrolling:
This is messing with some site components which are probably using jQuery 1.7.2 (which seems to be loaded by default with Proboards forums. I suppose jQuery 1.7.2 is used on the site because Proboards wants to support older IE versions).
My question would be if it's possible to install Javascript-based plugins which use jQuery in no-conflict mode without rendering some basic site functionality such as posting disfunctional. Can we use newer versions of jQuery on the sites or would this also create conflict problems with the default jQuery version loaded with Proboards by default?
All went well, I was able to enable smooth scrolling, but after I managed to do so, I noticed some things stopped working on the site. The WYSISYG post editor couldn't switch anymore from BBCode to Preview and if you wrote some text in it and pressed the Reply button, it failed to get posted. Instead, it discarded the text and reported you didn't write any text in your post.
After disabling the plugins loaded for smooth scrolling, posting started working again.
These are the JS files I linked in the forum wrapper:
TweenLite and ScrollToPlugin
This is the JS code I used to configure smooth scrolling:
/* This was added in a separate script tag, before the Tweenlite and Scroll plugins were linked */
var $j = jQuery.noConflict(true);
/* This was added in another script tag after the plugins were linked */
var $window = $j(window);
var scrollTime = 0.5;
var scrollDistance = 300;
mobile_ie = -1 !== navigator.userAgent.indexOf("IEMobile");
function smoothScrollListener(event){
event.preventDefault();
var delta = event.wheelDelta / 120 || -event.detail / 3;
var scrollTop = $window.scrollTop();
var finalScroll = scrollTop - parseInt(delta * scrollDistance);
TweenLite.to($window, scrollTime, {
scrollTo: {
y: finalScroll, autoKill: !0
},
ease: Power1.easeOut,
autoKill: !0,
overwrite: 5
});
}
if (!$j('html').hasClass('touch') && !mobile_ie) {
if (window.addEventListener) {
window.addEventListener('mousewheel', smoothScrollListener, false);
window.addEventListener('DOMMouseScroll', smoothScrollListener, false);
}
}
This is messing with some site components which are probably using jQuery 1.7.2 (which seems to be loaded by default with Proboards forums. I suppose jQuery 1.7.2 is used on the site because Proboards wants to support older IE versions).
My question would be if it's possible to install Javascript-based plugins which use jQuery in no-conflict mode without rendering some basic site functionality such as posting disfunctional. Can we use newer versions of jQuery on the sites or would this also create conflict problems with the default jQuery version loaded with Proboards by default?