How to add/compile/link an external CSS in AppDesigner, same with JQuery
조회 수: 5 (최근 30일)
이전 댓글 표시
We have this project, created category/by folder (css folder, views folder (html), js folder). I use AppDesigner and embed my index.html and run but it doesn't load all the styles and jquery. How can I link/compile it?
댓글 수: 0
답변 (1개)
Rushikesh
2024년 10월 11일
Hello John,
I understand you're facing an issue where external CSS and JS scripts linked in your HTML file aren't loading in MATLAB App Designer's HTML component. Let's address this step-by-step:
Root directory
|- views
|- index.html
|- CSS
|- style.css
|- JS
|- script.js
Here are some steps to resolve this issue:
1. According to the MATLAB documentation for the ‘uihtml’ component, referenced files like CSS and JS scripts should be in the same folder or a subfolder of your ‘index.html’ file. Therefore, consider moving your ‘index.html’ file out of the views folder and into the root directory, where the CSS and JS folders are located.
2. Ensure that the paths to your CSS and JS files in ‘index.html’ are relative to the file's location or use full paths. For example:
<script src="./JS/script.js"></script>
3. The ‘uihtml’ component in MATLAB cannot access third-party JavaScript libraries such as ‘jquery.min.js’ via a Content Delivery Network (CDN). Therefore, you need to download libraries like jquery.min.js and place them in your project directory.
Example: root >> JS folder >> jquery.min.js
Hope this helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Manage Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!