0

I converted html pages to visual force and referenced all used elements (css, javascript, pictures) as Static Resources. Within the code I see which javascripts are being used. However, when I try to run them, they do not work. What could be the problem here? One file is very complex and unstructured, so it is not easy to work with it. It seems as if the objects on the page cannot be found properly. Is there any advice on that? Thank you!

PS: There is no error in the console.

I convert the references as below:

script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min‌​.js">

into:

apex:includeScript value="{!URLFOR($Resource.xxx_js, 'xxx_js/jquery-3.1.0.min.js')}" />

script>window.jQuery || document.write('</script>')

into:

script>window.jQuery || document.write('</script>‌​')

And I have two more libraries,

apex:includeScript value="{!URLFOR($Resource.xxx_js, 'xxx_js/carousel.js')}" />

and

apex:includeScript value="{!URLFOR($Resource.xxx_js, 'xxx_js/main.js')}" />

There is one weird reaction, when I include the script "main.js", some elements get displaced. The script main.js only contains two functions though, function toggleMenu() {} and $(document).ready(function() {$("#xxx-carousel").xxxCarousel({ }); }); The xxx.carousel function then seems to relate to the carousel.js...

3
  • Visualforce itself has a lot of JS. One of the directions may be check if there are conflicts with VF code. But before -- confirm that all JS has been loaded properly
    – kurunve
    Jan 31, 2017 at 10:31
  • 1
    Also, let us know if you see any errors in the browser console(press F12). Jan 31, 2017 at 10:33
  • Unfortunately, there are no errors in the console. Jan 31, 2017 at 11:42

1 Answer 1

0

As we found the answer, I copied the code from the Chrome developer tools. It seems that there was additional code added by Javascript. As we got the original html code, we could clear the additions which got the code running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .