Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript/JQuery conflict?

Featured Replies

I'm trying to add a 'back to top button' and it looks like the javascript/jquery is conflicting with my image slider.

when i add the script towards the end of the body tag, either the image slider or the back to top will not work correctly.

if i place the back to top script before the slider script, the back to top plugin does not appear at all.

if i place the back to top script after the image slider script, the back to top appears and works fine but the image slider does not load the images.

this is the script i added

 

<!-- Back To Top jquery -->
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<!-- UItoTop plugin -->
<script src="js/jquery.ui.totop.js" type="text/javascript"></script>
<!-- Starting the plugin -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
 containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/

$().UItoTop({ easingType: 'easeOutQuart' });

});
</script>

 

url: http://thoroprod.com

Edited by thoroprod

you only need to load the jQuery library once and at a quick look at your page I saw three. Add the one above and that's four. They will conflict, especially if they are different releases.

I'm trying to add a 'back to top button' and it looks like the javascript/jquery is conflicting with my image slider.

when i add the script towards the end of the body tag, either the image slider or the back to top will not work correctly.

if i place the back to top script before the slider script, the back to top plugin does not appear at all.

if i place the back to top script after the image slider script, the back to top appears and works fine but the image slider does not load the images.

this is the script i added

 

<!-- Back To Top jquery -->
<script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
<!-- UItoTop plugin -->
<script src="js/jquery.ui.totop.js" type="text/javascript"></script>
<!-- Starting the plugin -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
 containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/

$().UItoTop({ easingType: 'easeOutQuart' });

});
</script>

 

url: http://thoroprod.com

 

Hi Thoroprod,

 

It could be that the different instances of Jquery are conflicting. Before your function, try creating a no conflict variable like: var $ui = $.noConflict();

 

Then when you call the UI Top plugin, call it using your new variable. Like this:

 

var $ui = $.noConflict();
$(document).ready(function() {
$ui().UItoTop({ easingType: 'easeOutQuart' });
});

 

Lyndsey.

Hi Thoroprod,

 

It could be that the different instances of Jquery are conflicting. Before your function, try creating a no conflict variable like: var $ui = $.noConflict();

 

Then when you call the UI Top plugin, call it using your new variable. Like this:

 

var $ui = $.noConflict();
$(document).ready(function() {
$ui().UItoTop({ easingType: 'easeOutQuart' });
});

 

Lyndsey.

 

I think you can safely change your Experience to at least 'Intermediate'. :|

  • Author

thanks for the responses everyone

 

i got it to work by removing one of the references to jquery as there was a duplicate!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.