Open Popover by loading the page and closing by the button

0

I have this Popover and I would like that when loading the page it was opened, and only closed after the user clicked on Entendi

ThecodeI'musingisthisScript:

$(document).ready(function(){//Associaoeventodopopoveraoclicarnolink.$('#Responsivo').popover({//trigger:'manual',placement:'bottom',html:true,title:'Oqueéumsiteousoftwareresponsivo?',content:$('#div-popover').html()//Adicionaoconteúdodadivocultaparadentrodopopover.}).click(function(e){e.preventDefault();//Exibeopopover.$(this).popover('show');});});

thetextofTag:

<h4><b>CriaçãodeSiteseSoftwares<spanid="Responsivo" >responsivos</span>:</b></h4>

and this Modal to Popover :

<div id="div-popover" class="hide">
    Dizer que um site ou um software é repsonsivo, indica que ele pode ser utilizado em computadores, tablets, tvs e celulares smartphones. o conteúdo do seu site, se ajusta de acordo com a tela do disposivo.
    <br /><br />
    <button id="close" class="btn btn-primary">Entendi</button>
</div>

I tried to do script that made hide in div , but it did not roll, I believe that div is only being displayed in Popover , so I would have to close Popover and not div .

    $('#close').click(function () {
        $('#div-popover').hide();
    });
    
asked by anonymous 23.12.2016 / 18:33

2 answers

1

You can use the event show.bs.popover

$(document).ready(function () {

    $('#Responsivo').popover({
        //trigger: 'manual',
        placement: 'bottom',
        html: true,
        title: 'O que é um site ou software responsivo?',
        content: $('#div-popover').html() // Adiciona o conteúdo da div oculta para dentro do popover.
    }).popover('show');

});

And to close:

$(document).on('click', 'button#close', function () {
    $('#Responsivo').popover('hide');
});

Example

    
23.12.2016 / 18:56
2

Just add .popover('show') to popup creation.

$(document).ready(function() {
    // Associa o evento do popover ao clicar no link.
    $('#Responsivo').popover({
        //trigger: 'manual',
        placement: 'bottom',
        html: true,
        title: 'O que é um site ou software responsivo?',
        content: $('#div-popover').html() // Adiciona o conteúdo da div oculta para dentro do popover.
    }).click(function(e) {
        e.preventDefault();
        // Exibe o popover.
        $(this).popover('show');
    }).popover('show');
});

To close from the button ..

$('#close').click(function() {
    $('#Responsivo').popover('hide');
});
    
23.12.2016 / 19:16