AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

User account menu fly out the screen in small screen

Open eruvierda opened this issue 9 years ago • 14 comments

dear @almasaeed2010 I used your admin LTE as a foundation building my web apps school project I found an issue that the user account menu fly outside the screen when screen is resized

bank sampah 3

my code

 <!-- Navbar Right Menu -->
        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            
          <!-- User Account Menu -->
            <li class="dropdown user user-menu">
              <!-- Menu Toggle Button -->
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <!-- The user image in the navbar-->
                <img src="<?php echo base_url('assets/avatar/avatar_default.png');?>" class="user-image" alt="User Image">
                <!-- hidden-xs hides the username on small devices so only the image appears. -->
                <span class="hidden-xs"><?php echo $this->session->userdata('fullname');?></span>
              </a>
              <ul class="dropdown-menu">
                <!-- The user image in the menu -->
                <li class="user-header">
                  <img src="<?php echo base_url('assets/avatar/avatar_default.png');?>" class="img-circle" alt="User Image">

                  <p>
                    <small><?php echo $this->session->userdata('fullname');?></small>
                  </p>
                </li>
                <!-- Menu Body -->
               
                <!-- Menu Footer-->
                <li class="user-footer">
                  <div class="pull-right">
                    <a href="<?php echo base_url(); ?>Auth/logout" class="btn btn-default btn-flat">Sign out</a>
                  </div>
                </li>
              </ul>
            </li>
          </ul>
        </div>
        <!-- /.navbar-custom-menu -->
      </div>

eruvierda avatar Jan 03 '17 15:01 eruvierda

Hello @eruvierda,

I tested the menu on all screen sizes but couldn't replicate the issue. Could you please provide the size that makes this issue happen?

Thanks!

almasaeed2010 avatar Jan 08 '17 17:01 almasaeed2010

sorry for the delay @almasaeed2010 I'm facing midterm test this week.

its not showing when I resized to nearly mobile phone screen size. perhaps its something wrong when I edit the code using the base template.

when I use mozilla to inspect and check the screen size, it happened below 980x1280. what code do i need to provide the detailed inspection?

eruvierda avatar Jan 11 '17 12:01 eruvierda

Unfortunately, I still couldn't reproduce the issue on FireFox even after testing it with multiple screen sizes. It could very well be something simple like missing a closing </div> or a markup error in general. It would be wise to split your components into their own ``.php``` files for example to reduce the amount of HTML markup in each page making it easier to debug. Otherwise, please provide a link to your implementation that might help us to identify your issue better.

Goodluck with your midterms!

almasaeed2010 avatar Jan 11 '17 14:01 almasaeed2010

@almasaeed2010 here is my implementation pagehttps://goo.gl/yN6MWa

I already split it into several .php files ; header.php , dashboard.php etc. I place user account menu in header.php

to access the page unit to login this is your user name and pass

username : almasaeed
password : test

eruvierda avatar Jan 11 '17 15:01 eruvierda

@eruvierda Sorry that i used almasaeed's login but i found your problem 😄

Your whole main-header structure is not correct, but you can simple fix that problem with removing the <div class="container-fluid"> around a.sidebar-toggle & div.navbar-custom-menu

REJack avatar Jan 11 '17 15:01 REJack

I removed the <div class="container-fluid"> as you suggested but the problem still occurred. please open it using firefox under 800×1280px

as long as I get the solution test account is no problem to be used @REJack

eruvierda avatar Jan 11 '17 16:01 eruvierda

i cant see a problem under 800x1280px, it looks fine for me

REJack avatar Jan 11 '17 17:01 REJack

I found only a problem with the user dropdown. I would recommend it to rebuild the <header class="main-header">, it doesn't look correct, that should fix your problems

REJack avatar Jan 11 '17 17:01 REJack

I'll try rebuilding the main-header help I could find the problem soon.

its midnight here 💃 💃

eruvierda avatar Jan 11 '17 17:01 eruvierda

I hope you find it, you can update AdminLTE too your version is 2.3.7 😄

REJack avatar Jan 11 '17 17:01 REJack

@eruvierda,

Have you resolved your issue? If so, please let us know :)

Thanks!

almasaeed2010 avatar Jan 14 '17 06:01 almasaeed2010

I still haven't resolved the problem. very busy weekend (moving) I start review the code again this night.

well I've found it.... its here: problem found

I got the right position in 529x1024 screen size by changing the value in firebug

element { top: 50px; -->disable this one left: 320px; --> value that I change }

529x1024

where should I change the code? @almasaeed2010 @REJack

eruvierda avatar Jan 16 '17 16:01 eruvierda

Solved : when I work with my pal, it seems we wrote down this code in the header that affect user menu dropdown setting. just need to delete it. Thanks for all your concern @almasaeed2010 @REJack

    $(document).ready(function() {
    $('.navbar a.dropdown-toggle').on('click', function(e) {
        var $el = $(this);
        var $parent = $(this).offsetParent(".dropdown-menu");
        $(this).parent("li").toggleClass('open');

        if(!$parent.parent().hasClass('nav')) {
            $el.next().css({"top": $el[0].offsetTop, "left": $parent.outerWidth() - 4});
        }

        $('.nav li.open').not($(this).parents("li")).removeClass("open");

        return false;
    });
});

  </script>```


eruvierda avatar Jan 17 '17 00:01 eruvierda

Thanks for sharing the solution with us!

almasaeed2010 avatar Jan 17 '17 14:01 almasaeed2010