Jump to content

js в шаблоне


avgaz

Recommended Posts

Добрый день, подскажите почему вот этот код js

<div id="my_div"></div>
<script type="text/javascript">
if (window.screen.width < 1000){
$( "#my_div" ).load( "/small.ya" );
}else {
$( "#my_div" ).load( "/big.ya" );
}
</script>

работает только если его вставить в самый низ после?

{template="includeJS" if="theme.js_include == 'footer'" app="core" group="global" location="global" params=""}

если вставить выше он просто перестает работать, хотелось бы засунуть его выше. Можно <div id="my_div"></div> выше, а js в низ но в таком случае код срабатывает уже после загрузки страницы то есть с задержкой, которая не нужна ((

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Ваша ссылка была автоматически строена.   Отображать как обычную ссылку

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...