Quantcast
Channel: Conversion html to Visualforce - Javascripts not running - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 2

Conversion html to Visualforce - Javascripts not running

$
0
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...


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images