I am using NextGen gallery plugin for my wordpress and my own script for header slider.
Header slider contains:
js/jquery.min.js
js/responsiveslides.js
I have this block of code in functions.php:
add_action(‘init’, ‘add_javascript’);
function add_javascript() {
// Add JQuery
wp_enqueue_script('jquery');
// Add the scripts
$js_url = get_bloginfo('stylesheet_directory') . '/js';
wp_enqueue_script('jquery-min',"$js_url/jquery.min.js");
wp_enqueue_script('responsiveslides',"$js_url/responsiveslides.min.js");
}
and this in header.php:
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
<script>
$(function () {
$("#slider").responsiveSlides({
maxwidth: 3200,
speed: 800
});
});
<script>
jQuery(document).ready(function($){
$(window).scroll(function(){
if ($(this).scrollTop() > 50) {
$('.backToTop').fadeIn('slow');
} else {
$('.backToTop').fadeOut('slow');
}
});
$('.backToTop').click(function(){
$("html, body").animate({ scrollTop: 0 }, 500);
return false;
});
});
</script>
</head>
I think jquery is loaded twice so now the gallery doesn’t work properly. How should I put the code so both header slider and gallery will work?
Here’s my website http://193.2.241.108/wordpress/
You are loading jQuery twice.
Remove one of your references to jQuery and that should fix the problem.