Javascript in K2 extra fields problem

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Mon Mar 02, 2015 12:46 am
Reply with quote
Report this post
Hi,

I have a small problem. in the HTML extra fields in K2 articles I'm implementing an JavaScript code mixed with HTML. The problem is when I add within the code ( <script src="..../calc/js/simple-slider.min.js" type="text/javascript"></script> ) inside the text field everything works fine but when I remove that line and load the simple-slider.min.js from the Joomla core as you suggested in some post its not working. In the page source I see the simple-slider.min.js loaded.

Where should I search the problem?

Thanks,
skullmonkey
User avatar
Platinum Boarder

GK User
Mon Mar 02, 2015 4:06 pm
Reply with quote
Report this post
Could you please post an url to your site where I can check this code?
User avatar
Moderator

GK User
Mon Mar 02, 2015 6:57 pm
Reply with quote
Report this post
Hi,
here you go: http://www.gorast.com/eusnov/mk/krediti ... it-instant

The slider on the right. Works fine when scripts are called from within the code but when put in joomla js folder and lines added in Header its not.

Thanks,
Gorast
User avatar
Platinum Boarder

GK User
Tue Mar 03, 2015 7:35 am
Reply with quote
Report this post
I guess the problem is with jQuery which you load twice - once from template itself and once from your script. Could you please create a separate article/page and place your module with linking scripts just to verify that?
User avatar
Moderator

GK User
Tue Mar 10, 2015 1:51 am
Reply with quote
Report this post
Hi,
I'm doing more testing and when I loose the line:
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.3.min.js" type="text/javascript"></script>

from the code the script dont work, even that I see <script src="/eusnov/media/jui/js/jquery.min.js" type="text/javascript"></script> in the page source.

Why is that?

Thanks,
Gorast
User avatar
Platinum Boarder

GK User
Thu Mar 12, 2015 5:23 pm
Reply with quote
Report this post
Because script itself might require some methods that were implemented in newest jQuery version, and are not available in one served by Joomla. Please verify js console for errors.
User avatar
Moderator


cron