/ Published in: jQuery
do you want to check a file exists using jQuery ?
that's is useful for none server side support servers or static projects
or for multi-themes website
هذا الكود ÙŠÙيدك ÙÙŠ التØÙ‚Ù‚ من وجود مل٠على Ø§Ù„Ø³ÙŠØ±ÙØ± بدون Ø§Ù„ØØ§Ø¬Ø© للتعامل مع لغة خادم
Ù…Ùيدة جداً للمواقع العادية والتي تستخدم أكثر من ثيم ÙÙŠ الموقع
that's is useful for none server side support servers or static projects
or for multi-themes website
هذا الكود ÙŠÙيدك ÙÙŠ التØÙ‚Ù‚ من وجود مل٠على Ø§Ù„Ø³ÙŠØ±ÙØ± بدون Ø§Ù„ØØ§Ø¬Ø© للتعامل مع لغة خادم
Ù…Ùيدة جداً للمواقع العادية والتي تستخدم أكثر من ثيم ÙÙŠ الموقع
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// url like : http://yoursite.com/hello // url like : http://yoursite.com/second var pathArray = window.location.pathname.split('/'); $.ajax({ url: "/css/my_style_"+pathArray[1].toLowerCase()+".css", type:'HEAD', error: function() { $("#colorCss").attr("href","/css/my_style.css"); }, success: function() { $("#colorCss").attr("href","/css/my_style_"+pathArray[1].toLowerCase()+".css"); } });
Comments
Subscribe to comments
