# Notícias com imagem na home

Snippet para criar notícias com imagens para serem exibidas na home.

{% tabs %}
{% tab title="HTML" %}

```html
{#
  # Noticias com imagem
#}

{% for pages in pages.custom %}
    {% if pages.info == "noticias" %}
    <div class="section-notices">
        <h2 class="title-section">
            <a href="/loja/busca_noticias.php">
                <span>Confira Nossas Notícias</span>
            </a>
        </h2>
        <div class="noticias-content">
        </div>
    </div>
    {% endif %}
{% endfor %} 
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
jQuery(function(){
  setTimeout(function() {
    document.getElementsByTagName("html")[0].getAttribute("data-store");
    var s = "busca_noticias.php?loja=" + document.getElementsByTagName("html")[0].getAttribute("data-store") +'&'+ document.getElementsByTagName("html")[0].getAttribute("data-files")
      , e = jQuery(".noticias-content");
    jQuery.ajax({
        url: s,
        type: "GET",
        dataType: "html",
        success: function(s) {
            var t = s.replace(/src/g, 'src');
            e.html('<div class="noticias">' + jQuery(t).find(".noticias").html() + "</div>"),
            e.find("li").wrapInner('<div class="box-noticia"></div>').find('img').attr('width', '400').attr('height', '400'),
            e.find(".noticias li:nth-child(n+5)").remove(),
            e.find('.noticias li').length ? '' : jQuery('.section-notices').remove();
        }
    })
  }, 400);
})
```

{% endtab %}
{% endtabs %}

### Como usar <a href="#como-usar" id="como-usar"></a>

Copie o código ***HTML*** acima e insira no arquivo `home.html` onde desejar.

Para o arquivo ***JavaScript*** crie um novo arquivo na pasta ***JS*** e faça sua chamada conforme exemplo:

```javascript
<script type="text/javascript" src="{{ asset('js/load-news.js') }}"></script>
```
