0

I have a problem with my code. So I have two blocks of publicity. The first:

<div id="top-pub" style="margin-bottom: 10px;">
    <style type="text/css">
        #gameBackground{
            margin-top: 10px;
            margin-bottom: 10px;
        }
    </style>
    {% block site_under %}
        <script type="text/javascript">
            sas.call("std", {
                siteId: 12345,    //
                pageId: 12345,    // Page : Prizee/home
                formatId: 12345,    // Format : Prizee - Megabanner 728x90
                target: ''    // Ciblage
            });
        </script>
        <noscript>
            <a href="http://www6.smartadserver.com/ac?jump=1&nwid=12345&siteid=1234&pgname=home&fmtid=12345&visit=m&tmstp=[timestamp]&out=nonrich" target="_blank">
                <img src="http://www6.smartadserver.com/ac?out=nonrich&nwid=12345&siteid=12345&pgname=home&fmtid=12345&visit=m&tmstp=[timestamp]" border="0" alt="" /></a>
        </noscript>
    {% endblock %}
</div>

The second block:

<div class="right-bloc-pub-1">
    {% block right_pub %}
    <script type="text/javascript">
        sas.call("std", {
            siteId: 4321,    //
            pageId: 4321,    // Page : Prizee/home
            formatId: 4321,    // Format : Prizee - 300x600 300x600
            target:        ''    // Ciblage
        });
    </script>
    <noscript>
        <a href="//www6.smartadserver.com/ac?jump=1&nwid=4321&siteid=4321&pgname=home&fmtid=4321&visit=m&tmstp=[timestamp]&out=nonrich" target="_blank">
            <img src="//www6.smartadserver.com/ac?out=nonrich&nwid=4321&siteid=4321&pgname=home&fmtid=4321&visit=m&tmstp=[timestamp]" border="0" alt="" /></a>
    </noscript>
    {% endblock %}
</div>

Now in the .css I do:

@media only screen and (min-width: 1300px) {
#top-pub{
  display: none !important;
 }
}

I want in fact to don't call the script for the id : #top-pub if resolution is small than 1300. Not only hide them. Is it possible to do that?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Harea Costicla
  • 797
  • 3
  • 9
  • 20
  • Please remove the PHP tag. This question is not related with PHP in anyway. – RajivRisi Oct 15 '15 at 13:24
  • with jQuery you can get the window width as `var newWindowWidth = $(window).width();`. Just check it before your `sas.call("std"` and make a call only `if(newWindowWidth >= 1300){ }` – vijayP Oct 15 '15 at 13:27
  • Possibly a duplicate of http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript – BCDeWitt Oct 15 '15 at 13:36

0 Answers0