两个下拉菜单,其中两个下拉菜单按ID或类分开

时间:2020-03-28 00:40:52

标签: javascript html twitter-bootstrap


<!-- /#CODIGO NOTIFICACIONES FIXED  ONLY RECUPERA -->
<script>

$(document).ready(function(){
 function load_unseen_notificationfix(viewfix = '')
 {
  $.ajax({
   url:"./notisystem/fetch.php",
   method:"POST",
   data:{viewfix:viewfix},
   dataType:"json",
   success:function(data)
   {
    $('.dropdown-toggle-notifixed').html(data.notificationfix);
    if(data.unseen_notificationfix > 0)
    {
             $('.countfixed').html(data.unseen_notificationfix);
    }
   }
  });
 }

  load_unseen_notificationfix();


 $(document).on('click', '.dropdown-toggle-notifixed', function(){
  $('.countfixed').html('');
  load_unseen_notificationfix('yes');
 });

 setInterval(function(){ 
  load_unseen_notificationfix();; 
 }, 5000);

});

</script> 




<!-- /#CODIGO NOTIFICACIONES PERSON  ONLY RECUPERA -->
<script>
$(document).ready(function(){

 function load_unseen_notification(view = '')
 {

    var notiusersesion = "<?php echo $email_login ?>";


  $.ajax({
   url:"./notisystem/fetchperson.php",
   method:"POST",
   data:{view:view, notiusersesion:notiusersesion},
   dataType:"json",
   success:function(data)
   {
    $('.dropdown-menu').html(data.notification);
    if(data.unseen_notification > 0)
    {
       var audio = new Audio('./notisystem/bing.mp3');
       audio.play();    
     $('.count').html(data.unseen_notification);
    }
   }
  });
 }

  load_unseen_notification();


 $(document).on('click', '.dropdown-toggle', function(){
  $('.count').html('');
  load_unseen_notification('yes');
 });

 setInterval(function(){ 
  load_unseen_notification();; 
 }, 5000);

});
</script> 
<div class="dropdown">
        <a class="btn btn-light dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        <span class="badge badge-danger count" style="border-radius:10px;"></span>       
        <span class="far fa-envelope" style="font-size:18px;"></span>
    </a>

    <div class="dropdown-menu" id="person" aria-labelledby="dropdownMenuLink">
</div>
</div>
 <!-- buzon de custom finish -->



<!-- buzon de fixed start -->

<div class="dropdown notifixed">
    <a class="btn btn-light dropdown-toggle dropdown-toggle-notifixed" href="#" role="button" id="dropdownMenufix" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    <span class="badge badge-warning countfixed" style="border-radius:10px;"></span>       
    <span class="far fa-envelope notifixed" style="font-size:18px;"></span>
</a>

<div class="dropdown-menu notifixed" id="notifixed" aria-labelledby="dropdownMenufix">

</div>
</div>
<!-- buzon  de fixed end -->

您好,我们正在尝试有2个用于检索通知的小邮箱,一个正在工作,因此我们只需复制代码并尝试使用引导程序自定义它以创建两个下拉菜单,count和countfixed类来自创建数字消息的JavaScript。来自db查询的消息,当我们只有一个消息获取功能时,通知工作是完美的,因为视图对我们不起作用,如何将这两个元素用id或class分隔并使它们并排对齐水平地?谢谢。

0 个答案:

没有答案