掲示板
jQuery library not working in theme
12年前 に Dave S によって更新されました。
jQuery library not working in theme
New Member 投稿: 12 参加年月日: 11/08/09 最新の投稿
Hi,
I've added <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</script> in the theme head. No jquery behavior works with just this. If I include this same reference directly in the web content display where I have the jquery behavior, it works fine. Anybody have ideas why the reference in the head is being ignored?
Thanks!
I've added <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</script> in the theme head. No jquery behavior works with just this. If I include this same reference directly in the web content display where I have the jquery behavior, it works fine. Anybody have ideas why the reference in the head is being ignored?
Thanks!
12年前 に Mayur Patel によって更新されました。
RE: jQuery library not working in theme
Expert 投稿: 358 参加年月日: 10/11/17 最新の投稿
We have included js like this,
Refer this,
https://gist.github.com/1281821
<title>$the_title - $company_name</title>
$theme.include($top_head_include)
<script src="$themeDisplay.getPathThemeJavaScript()/jquery-1.4.2.min.js"></script>
Refer this,
https://gist.github.com/1281821
12年前 に ANIL MISRA によって更新されました。
RE: jQuery library not working in theme
New Member 投稿: 3 参加年月日: 10/06/16 最新の投稿
Hi,
You can make a folder under _diffs and put your js file under same folder and give the path like that
<script src="/theme-name/js/jquery.min.js" type="text/javascript"></script>
and it will work.
You can make a folder under _diffs and put your js file under same folder and give the path like that
<script src="/theme-name/js/jquery.min.js" type="text/javascript"></script>
and it will work.
12年前 に Dave S によって更新されました。
RE: jQuery library not working in theme
New Member 投稿: 12 参加年月日: 11/08/09 最新の投稿
Thanks! It turned out that there was a library conflict when I included the jquery library reference in the theme. I wrapped each bit of custom jQuery with:
jQuery.noConflict();
jQuery(document).ready(function($) {
//all code here
});
I then replaced every "$" with "jQuery", and everything worked fine.
jQuery.noConflict();
jQuery(document).ready(function($) {
//all code here
});
I then replaced every "$" with "jQuery", and everything worked fine.