[英]How can I test UI with kotlin JS? (e.g. have an element on a page)
[英]How can I play an animation on page load in jQuery so that it plays for index.php but not e.g. other_page.php
我想在頁面加載時播放動畫,但只對我的index.php播放,而不對網站的其他頁面播放。
jQuery是否有類似這樣的內容:
$('index.php').ready(function());
?
如果沒有,我怎么能達到預期的效果?
只需使用以下任何jquery加載函數將jQuery代碼放入index.php頁面即可。
$(window).load(function(){...});
要么
$(document).ready(function(){...});
要么
$('body').onload(function(){...});
這樣,您的動畫將僅在index.php頁面上運行,而不在其他任何頁面上運行。
希望這能解決您的問題。
您可以使用Javascript檢查網址,然后觸發您要播放的功能
if(
window.location.href=="address to check"
)
your_function();
{
/* some code to load */
}else{
document.write('<div>testing my super loaded div code sample</div>')
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.