how to stop clash between jquery and protoype on this page - javascript

This page is a combination of magento and a wordpress theme. Unfortunately the jquery is causing the protoype not to work but I'm not to amazing at using developer tools to locate these kinds of problems.
My understanding is that I need to run jquery in noConflict mode but I can't find where it is called from the wordpress theme.
Can anyone advise how I can locate this or solve the problem.
http://www.findcarpettiles.co.uk/wp/general-information/free-samples-measurement/
Thanks

jQuery is included and ran in noConflict mode automatically. I believe your problem is that you include two versions of jQuery (one from Magento and one from WP). If I were you, I would add the following to your functions.php to stop WP from including its version of jQuery.
add_filter( 'wp_default_scripts', 'change_default_jquery' );
function change_default_jquery( &$scripts){
if(!is_admin()){
$scripts->remove( 'jquery');
}
}

Related

Visual Composer / Jquery Animations not working Debug Error

I have visual composer installed on a wordpress site. For some reason when i isert and image or any element and apply the animation from inside visual composer, the page goes blank and nothing shows, no animations, nothing.
After contacting the plugin developer they said another plugin is conflicting but i have just 1 other plugin installed, jetpack. I have uinstalled that and the problem persists.
Using the debug tool i get the following errors. any ideas?
Uncaught TypeError: a.indexOf is not a function
at r.fn.init.r.fn.load (jquery.min.js?ver=3.1.1:4)
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
at waypoints.min.js?ver=5.0.1:8
Uncaught TypeError: f.getClientRects is not a function
at r.fn.init.offset (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:4:20376)
at t.refresh (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:2072)
at t. (http://#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6130)
at Function.each (https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js?ver=3.1.1:2:2865)
at refresh (http:#####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:6100)
at Function.n.(anonymous function) [as waypoints] (http://###wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:7638)
at r.fn.init.init (http://####/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:4817)
at r.fn.init.n.fn.(anonymous function) [as waypoint] (http://######/wp-content/plugins/js_composer/assets/lib/waypoints/waypoints.min.js?ver=5.0.1:8:5712)
at function.window.vc_waypoints.window.vc_waypoints (http://####/wp-content/plugins/js_composer/assets/js/dist/js_composer_front.min.js?ver=5.0.1:1:7243)
By default, the latest version of WordPress uses jQuery version 1.12.4 but your site seems to be calling jQuery 3.1.1 via Google's CDN. It's possible that Visual Composer isn't compatible with jQuery 3 yet.
If this is the only plugin on the site, then it's likely the theme calling this jQuery version. And if it's properly coded, you should be able to find a wp_register_script or wp_enqueue_script function that is overriding the jQuery version. If you replace that with wp_enqueue_script( 'jquery' );, you'll load up WordPress' jQuery which may solve the issue.
Three notes:
The theme may have replaced jQuery by using wp_deregister_script. You'll need to comment that out too.
Changing the jQuery version may break javascript coming from your theme if that js needs jQuery version 3 so look for issues on that end as well.
When you update your theme, it will revert this change. So you should consider doing this through a child theme to preserve your changes across updates.

Nivo Slider not working with wordpress

All of a sudden the nivo slider on one of our clients websites is not showing up at all: www.bedehouse.org
I have tried all sorts but cannot see why its stopped all of a sudden? We have not done any updates to wordpress or any of its plugins recently.
I can see using chromes "inpect element" feature that there is an error: "Uncaught TypeError: $(...).nivoSlider is not a function" but have no idea what it means.
Any helps or pointers in the right direction would be massively helpful.
You're loading two versions of jQuery. One is the copy WordPress is loading and the second is another.
Both are different versions (WP is loading 1.8.3 and you're loading 1.8.2). WordPress loads jQuery in noconflict mode and does not allow the use of the $ shortcut.
Remove the jQuery 1.8.2 call that you made and change all instances of $ to jQuery and try it.

Javascript Conflicts in Console for Wordpress Plugin Global Gallery

I hope you can help me to debug my conflicts on the site I am working on:
URL: http://metalotechnika.com
PW: 12345678
If you then go to http://metalotechnika.com/foto-galeri/foto-kangjella-hekuri/
You will find a gallery that isn't loading. Most probably due to javascript conflicts. Could you pint me in the right direction here?
You will find some errors in the console: "TypeError: jQuery(...).lcweb_lazyload is not a function"
I thougt, that it must be jQuery not loading correctly. But I already tested jQuery in my main.js, and is working. Don't know about this time.
Ok, found the problem.
jQuery is loaded 2 times. And this is were the conflict came from. I just removed jQuery from my functions.php because Wordpress already loads it's own jQuery and throws conflicts if it is loaded a separate different time.
Thanks anyway.

Wordpress 3.8 jQuery

I have a blog using Wordpress version 3.8 (http://tech-article.com). If I visit my site as a user it is working well. But if I visit my site after logging in as an admin than then hot post area JQuery effects such as rendering the post title and post avatar are not working.
I opened the console and got what you see below. May be JQuery is not working?
"undefined"!=typeof jQuery?("undefined"==typeof jQuery.fn.hoverIntent&&!function(a){a.fn.hoverIntent=function(b,c,d){var e={interval:100,sensitivity:7,timeout:0};e="object"==typeof b?a.extend(e,b):a.isFunction(c)?a.extend(e,{over:b,out:c,selector:d}):a.extend(e,{over:b,out:b,selector:c});var f,g,h,i,j=function(a){f=a.pageX,g=a.pageY},k=function(b,c){return c.hoverIntent_t=clearTimeout(c.hoverIntent_t),Math.abs(h-f)+Math.abs(i-g)<e.sensitivity?(a(c).off("mousemove.hoverIntent",j),c.hoverIntent_s=1,e.over.apply(c,[b])):(h=f,i=g,c.hoverIntent_t=setTimeout(function(){k(b,c)},e.interval),void 0)},l=function(a,b){return b.hoverIntent_t=clearTimeout(b.hoverIntent_t),b.hoverIntent_s=0,e.out.apply(b,[a])},m=function(b){var c=jQuery.extend({},b),d=this;d.hoverIntent_t&&(d.hoverIntent_t=clearTimeout(d.hoverIntent_t)),"mouseenter"==b.type?(h=c.pageX,i=c.pageY,a(d).on("mousemove.hoverIntent",j),1!=d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){k(c,d)},e.interval))):(a(d).off("mousemove.hoverIntent",j),1==d.hoverIntent_s&&(d.hoverIntent_t=setTimeout(function(){l(c,d)},e.timeout)))};return this.on({"mouseenter.hoverIntent":m,"mouseleave.hoverIntent":m},e.selector)}}(jQuery),jQuery(document).ready(function(a){var b,c,d,e=a("#wpadminbar"),f=!1;b=function(b,c){var d=a(c),e=d.attr("tabindex");e&&d.attr("tabindex","0").attr("tabindex",e)},c=function(b){e.find("li.menupop").on("click.wp-mobile-hover",function(c){var d=a(this);d.parent().is("#wp-admin-bar-root-default")&&!d.hasClass("hover")?(c.preventDefault(),e.find("li.menupop.hover").removeClass("hover"),d.addClass("hover")):d.hasClass("hover")||(c.stopPropagation(),c.preventDefault(),d.addClass("hover")),b&&(a("li.menupop").off("click.wp-mobile-hover"),f=!1)})},d=function(){var b=/Mobile\/.+Safari/.test(navigator.userAgent)?"touchstart":"click";a(document.body).on(b+".wp-mobile-hover",function(b){a(b.target).closest("#wpadminbar").length||e.find("li.menupop.hover").removeClass("hover")})},e.removeClass("nojq").removeClass("nojs"),"ontouchstart"in window?(e.on("touchstart",function(){c(!0),f=!0}),d()):/IEMobile\/[1-9]/.test(navigator.userAgent)&&(c(),d()),e.find("li.menupop").hoverIntent({over:function(){f||a(this).addClass("hover")},out:function(){f||a(this).removeClass("hover")},timeout:180,sensitivity:7,interval:100}),window.location.hash&&window.scrollBy(0,-32),a("#wp-admin-bar-get-shortlink").click(function(b){b.preventDefault(),a(this).addClass("selected").children(".shortlink-input").blur(function(){a(this).parents("#wp-admin-bar-get-shortlink").removeClass("selected")}).focus().select()}),a("#wpadminbar li.menupop > .ab-item").bind("keydown.adminbar",function(c){if(13==c.which){var d=a(c.target),e=d.closest("ab-sub-wrapper");c.stopPropagation(),c.preventDefault(),e.length||(e=a("#wpadminbar .quicklinks")),e.find(".menupop").removeClass("hover"),d.parent().toggleClass("hover"),d.siblings(".ab-sub-wrapper").find(".ab-item").each(b)}}).each(b),a("#wpadminbar .ab-item").bind("keydown.adminbar",function(c){if(27==c.which){var d=a(c.target);c.stopPropagation(),c.preventDefault(),d.closest(".hover").removeClass("hover").children(".ab-item").focus(),d.siblings(".ab-sub-wrapper").find(".ab-item").each(b)}}),a("#wpadminbar").click(function(b){("wpadminbar"==b.target.id||"wp-admin-bar-top-secondary"==b.target.id)&&(b.preventDefault(),a("html, body").animate({scrollTop:0},"fast"))}),a(".screen-reader-shortcut").keydown(function(b){var c,d;13==b.which&&(c=a(this).attr("href"),d=navigator.userAgent.toLowerCase(),-1!=d.indexOf("applewebkit")&&c&&"#"==c.charAt(0)&&setTimeout(function(){a(c).focus()},100))}),"sessionStorage"in window&&a("#wp-admin-bar-logout a").click(function(){try{for(var a in sessionStorage)-1!=a.indexOf("wp-autosave-")&&sessionStorage.removeItem(a)}catch(b){}}),navigator.userAgent&&-1===document.body.className.indexOf("no-font-face")&&/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test(navigator.userAgent)&&(document.body.className+=" no-font-face")})):!function(a,b){var c,d=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,function(){return c.call(a,window.event)})},e=new RegExp("\\bhover\\b","g"),f=[],g=new RegExp("\\bselected\\b","g"),h=function(a){for(var b=f.length;b--;)if(f[b]&&a==f[b][1])return f[b][0];return!1},i=function(b){for(var d,i,j,k,l,m,n=[],o=0;b&&b!=c&&b!=a;)"LI"==b.nodeName.toUpperCase()&&(n[n.length]=b,i=h(b),i&&clearTimeout(i),b.className=b.className?b.className.replace(e,"")+" hover":"hover",k=b),b=b.parentNode;if(k&&k.parentNode&&(l=k.parentNode,l&&"UL"==l.nodeName.toUpperCase()))for(d=l.childNodes.length;d--;)m=l.childNodes[d],m!=k&&(m.className=m.className?m.className.replace(g,""):"");for(d=f.length;d--;){for(j=!1,o=n.length;o--;)n[o]==f[d][1]&&(j=!0);j||(f[d][1].className=f[d][1].className?f[d][1].className.replace(e,""):"")}},j=function(b){for(;b&&b!=c&&b!=a;)"LI"==b.nodeName.toUpperCase()&&!function(a){var b=setTimeout(function(){a.className=a.className?a.className.replace(e,""):""},500);f[f.length]=[b,a]}(b),b=b.parentNode},k=function(b){for(var d,e,f,h=b.target||b.srcElement;;){if(!h||h==a||h==c)return;if(h.id&&"wp-admin-bar-get-shortlink"==h.id)break;h=h.parentNode}for(b.preventDefault&&b.preventDefault(),b.returnValue=!1,-1==h.className.indexOf("selected")&&(h.className+=" selected"),d=0,e=h.childNodes.length;e>d;d++)if(f=h.childNodes[d],f.className&&-1!=f.className.indexOf("shortlink-input")){f.focus(),f.select(),f.onblur=function(){h.className=h.className?h.className.replace(g,""):""};break}return!1},l=function(a){var b,c,d,e,f,g;if(!("wpadminbar"!=a.id&&"wp-admin-bar-top-secondary"!=a.id||(b=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,1>b)))for(g=b>800?130:100,c=Math.min(12,Math.round(b/g)),d=b>800?Math.round(b/30):Math.round(b/20),e=[],f=0;b;)b-=d,0>b&&(b=0),e.push(b),setTimeout(function(){window.scrollTo(0,e.shift())},f*c),f++};d(b,"load",function(){c=a.getElementById("wpadminbar"),a.body&&c&&(a.body.appendChild(c),c.className&&(c.className=c.className.replace(/nojs/,"")),d(c,"mouseover",function(a){i(a.target||a.srcElement)}),d(c,"mouseout",function(a){j(a.target||a.srcElement)}),d(c,"click",k),d(c,"click",function(a){l(a.target||a.srcElement)}),d(document.getElementById("wp-admin-bar-logout"),"click",function(){if("sessionStorage"in window)try{for(var a in sessionStorage)-1!=a.indexOf("wp-autosave-")&&sessionStorage.removeItem(a)}catch(b){}})),b.location.hash&&b.scrollBy(0,-32),navigator.userAgent&&-1===document.body.className.indexOf("no-font-face")&&/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test(navigator.userAgent)&&(document.body.className+=" no-font-face")})}(document,window);
When I used it with wordpress 3.6 it worked well. But this the problem appeared after update to version 3.8. Please give proper solution.
just took a casual look at your blog, it has jquery 1.4.2 included in your theme this is probably getting overwritten by "admin bar" javascript/jquery when you are logged in as admin. I am not sure as I never check if adminbar include it's own jquery. But remove jquery from theme and use wordpress enqueue function to include wordpress' default jquery this always ensure that you have one and latest version of jquery always included.
Really we need some more information code, server etc to provide the best help but I would suggest that it is likely once you login a new extension is becoming active. It may be loading Jquery and thus causing some sort of conflict.

JS creating a conflict with WP for a slideshow

I'm getting an issue with a javascript slideshow that I wish to embed in a WP header.
Here is the slideshow designed and ready to use: http://coachjoelleinc.com/wp-content/themes/32950/rotator/test.html
And this is where I want to embed it: http://coachjoelleinc.com/index_real.php/
In older versions of Firefox it disables other plugins, such as the navigation.
Any advice would be much appreciated.
It's looking fine in Chrome for me but the issues with older browsers might be caused by the fact you've loaded the jQuery library twice. Wordpress is loading the version that came with it (1.7.2) but prior to that version 1.5.1 is being loaded - probably by your theme's header.php rather than a plugin, the file is in the themes directory.
Bear in mind you have to load jQuery before you load all the scripts that rely on it, so if you remove the older version which is being loaded first you will need to make sure the other dependant scripts load are moved so they are loaded after the newer version of the jQuery library is loaded.
There are various ways to do that - you can enqueue them in functions.php, or move those scripts into the footer. A quick Google comes up the Codex Javascript guide along with some examples of including JS in Wordpress

Categories

Resources