简体   繁体   English

jQuery模式弹出动态内容

[英]Jquery modal pop up with dynamic content

I am working on someone script.I can t understand it clearly to implement my code.I need this content in modal pop up. 我正在编写某人脚本,我无法清楚地理解它来实现我的代码,我需要在模式弹出窗口中使用此内容。

    <div data-rel="close" data-role="panel" data-display="overlay" data-position="right" id="circle-more">
    <div class="details-arrow">
    <div class="boxscroll">
      <div class="contentscroll  circle-more-cont">  
      </div>
    </div>
    </div>
    </div>

Actually now its taking data dynamically from db and hidden.It working fine but it shows in page.I want to show this entire content in modal.can anybody help me.I tried all options nothing work out.


it get contents from here

function circleMoreDetailsSocial(social_ring_obj_index, comment_details, cur_obj)
{
    $(".circle-more-cont").html('');
    if (nice) nice.remove();
    var i = 1;
   $.each(circleData4[social_ring_obj_index], function(social_value_index, social_value)
    {
         $.each(social_value, function(value_index, value)
        {
            if(value[1] == 'facebook')
                social_media_link = "https://facebook.com/"+value[2];       
//              <div class='"+value_index+"' style='background-color:"+eval("color"+i)+"'>&nbsp;</div>
            $(".circle-more-cont").append("<a href="+social_media_link+" onclick='javascript: void(0)' return false;' ><p>"+value[0]+"</p></a>");
            i++;
        });
    });



  $("#circle-more").panel('open');
    nice =  $(".boxscroll").niceScroll(".contentscroll",{cursorcolor:"#F00",cursoropacitymax:0.7,boxzoom:true,touchbehavior:true}); 
return false;
}

This make some sense i think.it dynamically add content from json file as pargraphs.so when i click a paragraph it will redirect to some links.I dont want to get redirected.instead of that i just want to wrap everything under modal so i can stay in same page.redirect will done only in modal. 我认为这有道理。它动态地将json文件中的内容添加为pargraphs.so,所以当我单击一个段落时它将重定向到一些链接。我不想被重定向。相反,我只想将所有内容包装在模式下,所以我可以留在同一页面中。重定向仅在模式页面中完成。

please check demolink Reference link http://getbootstrap.com/javascript/#modals 请检查demolink参考链接http://getbootstrap.com/javascript/#modals

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

use jqueryui dialog -modal ... https://jqueryui.com/dialog/ 使用jqueryui对话框-modal ... https://jqueryui.com/dialog/

example: html 示例:html

 <div id="dialog-modal" title="Basic modal dialog">
     <p>Adding the modal overlay screen makes the dialog look more prominent because it dims          out the page content.</p>
 </div>

js: JS:

$(function() {
$( "#dialog-modal" ).dialog({
  height: 140,
  modal: true
  });
});

you can use jquery + jquery ui 您可以使用jquery + jquery ui

the code 编码

$(function(){
$( "#circle-more" ).dialog({
      height: 140,
      modal: true
    });
});

this a demo https://jqueryui.com/dialog/#modal 这是一个演示https://jqueryui.com/dialog/#modal

that's open the dialog at the start of the page. 即会在页面开始处打开对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM