MyBB Community Forums

Full Version: Help me with jquery noconflict
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi

i have done some custom modification to my theme. i have removed all the menu bars and the welcome blocks as it is pushing the main content down.

instead of the menu bars and welcome blocks i have added a slider panel to my site using jquery.

as expected jquery is now having a conflict with the javascripts on the site. for eg. i cant select a thread from inline moderation to delete/move it.

can someone help with the noconflict code that can be used to avoid this. pls tell me what need to be added to the following code or suggest a better code

<script type="text/javascript">
  $.noConflict();
  jQuery(document).ready(function($) {
  });
</script>
Try this instead:

<script type="text/javascript">
jQuery.noConflict();

jQuery(document).ready(function($) {
    // your actual JS to execute
});
</script>
thanks for the reply.. but sorry i coudnt make it work.... can you give the exact script...

the script which uses the jquery is as follows
$(document).ready(function() {
	$("#open").click(function(){
		$("div#slidepanel").slideDown("slow");
	});	
	
	$("#close").click(function(){
		$("div#slidepanel").slideUp("slow");	
	});		
	
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
});
Try this.

jQuery.noConflict();

jQuery(document).ready(function($) {

    $("#open").on('click', function(){
        $("div#slidepanel").slideDown("slow");
    });    
    
    $("#close").on('click', function(){
        $("div#slidepanel").slideUp("slow");    
    });        
    
    $("#toggle a").on('click', function () {
        $("#toggle a").toggle();
    });
});
thanks again but still it do not work.

if i add the script that you gave to the headerinclude after all the scripts. then the moderation part works but the slide dont work.

if i add the codes anywhere else (like at the top of headerinclude or in footer) then both the slide and the moderation part dont work.

any suggestions....
Could you link me to the site and explain exactly what it is you're trying to do?
my site: http://www.techtimes.co.in/

you could see a slider panel installed at the top. that is the one which uses jquery.

i have PMed you a admin user id and password. pls login to the site and open any forum and try to select any thread for moderation by clicking the checkbox. its not getting selected. that is the issue.

kindly login to ACP and check for errors.
You haven't updated the content of the jscripts/slide.js file. Update it to the code I pasted above.
i was adding it to the headerinclude templates in ACP Smile

ok now added to the slide.js file

and it works Smile

thanks a lot bro... i was adding the code to headerinclude and it was not working.
Glad it's all sorted now!