Vyacheslav 262 Posted January 15, 2015 Report Share Posted January 15, 2015 Ребята подскажите пожалуйста как вывести рекламу слева или справа типа как на сайте primamedia.ru Link to post Share on other sites
Модератор ApxuBapuyc 654 Posted January 15, 2015 Модератор Report Share Posted January 15, 2015 Css: Обратите внимание на position Link to post Share on other sites
Vyacheslav 262 Posted January 15, 2015 Author Report Share Posted January 15, 2015 Спасибо. Но я не догоняю если честно. это надо css прописывать? Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Этот код отвечает за вывод баннера, вставьте его в свой сайт и увидите. К тому же отображается при разрешении экрана равно или больше 1250 px <div id="left-baner"> <script language="JavaScript"> <!--//<![CDATA[ if (document.body.clientWidth >= '1250') { var m3_u = (location.protocol=='https:'?'https://revive.x.primamedia.ru/www/delivery/ajs.php':'http://revive.x.primamedia.ru/www/delivery/ajs.php'); var m3_r = Math.floor(Math.random()*99999999999); if (!document.MAX_used) document.MAX_used = ','; document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("?zoneid=216"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'><\/scr"+"ipt>"); } else { $("#left-baner").hide(); } //]]>--> </script> </div> Link to post Share on other sites
Vyacheslav 262 Posted January 15, 2015 Author Report Share Posted January 15, 2015 Этот код отвечает за вывод баннера, вставьте его в свой сайт и увидите. К тому же отображается при разрешении экрана равно или больше 1250 px <div id="left-baner"> <script language="JavaScript"> <!--//<![CDATA[ if (document.body.clientWidth >= '1250') { var m3_u = (location.protocol=='https:'?'https://revive.x.primamedia.ru/www/delivery/ajs.php':'http://revive.x.primamedia.ru/www/delivery/ajs.php'); var m3_r = Math.floor(Math.random()*99999999999); if (!document.MAX_used) document.MAX_used = ','; document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("?zoneid=216"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'><\/scr"+"ipt>"); } else { $("#left-baner").hide(); } //]]>--> </script> </div> Это понятно. Только там он идёт фиксированный. у меня не держится ломает шаблон. мне надо встроить туда рекламу от гугла. кто поможет. размещу статью с загоном в индексацию яши. Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Коды должны стоять теге body, с правой стороны код аналогичный <div id="right-baner"> <script language="JavaScript"> <!--//<![CDATA[ if (document.body.clientWidth >= '1250') { var m3_u = (location.protocol=='https:'?'https://revive.x.primamedia.ru/www/delivery/ajs.php':'http://revive.x.primamedia.ru/www/delivery/ajs.php'); var m3_r = Math.floor(Math.random()*99999999999); if (!document.MAX_used) document.MAX_used = ','; document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("?zoneid=217"); document.write ('&cb=' + m3_r); if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used); document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : '')); document.write ("&loc=" + escape(window.location)); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if (document.mmm_fo) document.write ("&mmm_fo=1"); document.write ("'><\/scr"+"ipt>"); } else { $("#right-baner").hide(); } //]]>--> </script> </div> Link to post Share on other sites
Vyacheslav 262 Posted January 15, 2015 Author Report Share Posted January 15, 2015 хоть body хоть не body всё равно ломает шаблон. Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Там еще стили css задействованы, можно найти что отвечает, у меня получилось вот так можете посмотреть http://strawberryfarm.info/klon.htm Link to post Share on other sites
Vyacheslav 262 Posted January 15, 2015 Author Report Share Posted January 15, 2015 Там еще стили css задействованы, можно найти что отвечает, у меня получилось вот так можете посмотреть http://strawberryfarm.info/klon.htm Да у Вас работает. У меня юкоз. Может из за этого шаблон ломается??? Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Стили добавьте в header, <link rel="stylesheet" type="text/css" href="http://primamedia.ru/inc/js/ui-css/jquery-ui.css?1265854052" /> <link rel="stylesheet" href="http://primamedia.ru/inc/css/jcarousel/skin.css" type="text/css" media="all" /> <link href="http://primamedia.ru/inc/global.css?11421118113" rel="stylesheet" type="text/css" /> Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Вот эти стили отвечают за позицию рекламных баннеров их надо вставить в тег head <style> #left-baner, #right-baner { height: 500px; width: 115px; top: 2px; position: fixed; } #left-baner { left: 2px; } #right-baner { right: 2px; } </style> Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Короче, чтобы вставить код adsense вставляем код такой в head баннер будет размером 120-600 <style> #left-baner, #right-baner { height: 600px; width: 115px; top: 2px; position: fixed; } #left-baner { left: 2px; } #right-baner { right: 2px; } </style> в body <div id="left-baner"> здесь код adsense </div> <div id="right-baner"> здесь код adsense </div> Link to post Share on other sites
VIP campusboy 912 Posted January 15, 2015 VIP Report Share Posted January 15, 2015 После этих манипуляций вы получите спелый банан от Гугла, ибо Недопустимые приемыВот некоторые приемы, которых следует избегать: скрытие рекламных блоков, например с помощью параметра display:none (впрочем, это допустимо, если используются адаптивные рекламные блоки); показ объявлений AdSense поверх основного содержания сайта; размещение более трех рекламных блоков AdSense на одной странице; влияние на таргетинг объявлений, в том числе с помощью скрытых ключевых слов, фреймов и других приемов; распространение объявлений по электронной почте или в составе программного обеспечения; размещение объявлений в плавающих окнах и перемещающихся рекламных блоках с целью привлечения внимания. Link to post Share on other sites
desg 55 Posted January 15, 2015 Report Share Posted January 15, 2015 Это делается с помощью CSS и HTML за три с половиной минуты. Зачем нужны кривые скрипты? Link to post Share on other sites
Sirge 22 Posted January 15, 2015 Report Share Posted January 15, 2015 Это делается с помощью CSS и HTML за три с половиной минуты. Зачем нужны кривые скрипты? Скрипты нужны для адаптивности шаблона, баннеры показываются только при разрешении экрана более 1250px при меньшем они не показываются. Между прочим сайт администрации Владивостока не дураки делали, вам бы поучиться лучше. Link to post Share on other sites
desg 55 Posted January 15, 2015 Report Share Posted January 15, 2015 Адаптивности шаблона? Извините мои познания в скрипте закончились, не знал что javascript умеет сам прописывать media-запросы. На будущее прочитайте статью о медиазапросах и что такое адаптивная верстка... ТС если Вам нужна ещё помощь пишите в лс. Link to post Share on other sites
Vyacheslav 262 Posted January 16, 2015 Author Report Share Posted January 16, 2015 Адаптивности шаблона? Извините мои познания в скрипте закончились, не знал что javascript умеет сам прописывать media-запросы. На будущее прочитайте статью о медиазапросах и что такое адаптивная верстка... ТС если Вам нужна ещё помощь пишите в лс. Спасибо. Работает! Link to post Share on other sites
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now