Help with jquery

Proximity

IDK?
Feb 13, 2014
673
56
I need help with this I have tired for ever and I cannot get it to work!!
Code:
<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <div class="container">
        <div class="rightr-side">
            <div class="c-title red">
                Navigator
            </div>
            <div class="c-main">
                <b>Staff Ranks</b><br>
                - <a href="#founders" id="loginform">Founders</a><br>
                - <a href="#Manager" id="manager">Manager</a><br>
                - <a href="#Administrators" id="admin">Administrators</a><br>
                - <a href="#Moderators" id="mod">Moderators</a><br>
                - <a href="#Tmods" id="tmod">Trial Moderators</a><br>
                - <a href="#Events" id="event">Events Staff</a>
            </div>
        </div>
    </div>
    <div class="about">
        <div class="container">
            <div class="left-side">
                <div class="c-box">
                    <div class="c-title red">
                        Staff Members
                    </div>
                    <div class="c-main">
                        To view the @sitename Staff, please select a rank from
                        the list on the container on the right
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src=
    "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript">
<?php
    $q = LightShot::$MySQL->query("SELECT * FROM users WHERE rank = ? ORDER BY id ASC LIMIT 5", Array(13));
    while($d = $q->fetch()){
        if($d['online'] == 1){ $online = 'Online'; }else{ $online = 'Offline'; } 
        if($d['online'] == 1){ $online2 = 'darkgreen'; }else{ $online2 = 'darkred'; } 
       
       
        echo '
    <div class="login">

    <div class="container">
                    <div class="left-side">
    <div class="c-box">
                                <div class="c-title red">'.$d['username'].'</div>
                                <div class="c-main">
                <div style=\'width: 64px; height: 81px; margin-top:-22px; margin-left:-10px; float: left; background: url(http://localhost/images/'.$d['look'].');\'>
                </div>
                <a href=\'/home/'.$d['username'].'\'><strong>'.$d['username'].'</strong></a><font color=\'grey\'> - '.$d['role'].'</font>                                      
                <div style=\'float: right; display: inline; margin-right: 10px;text-align: center;\'>
                    <div style=\'width: 48px; display: inline;height: 48px;margin-top: -9px;float: right; background: url(//xotel.co/swf/c_images/album1584/ADM.gif); background-position:center; background-repeat:no-repeat;\'>
                    </div><br />
                    <font color=\''.$online2.'\'><b>'.$online.'</b></font> 
                </div><br />
                <strong>Motto:</strong> '.$d['motto'].'<br>
    <strong>Last Online:</strong> '.date('d, M, Y', $d['last_online']).'    <br /><strong>Bans: </strong> | <strong>CFH\'s Responded: </strong> <br>                        
            </div>
        </div>
    </div></div></div>
        ';
    }
    ?> 
 <?php
    $q = LightShot::$MySQL->query("SELECT * FROM users WHERE rank = ? ORDER BY id ASC LIMIT 5", Array(11));
    while($d = $q->fetch()){
        if($d['online'] == 1){ $online = 'Online'; }else{ $online = 'Offline'; } 
        if($d['online'] == 1){ $online2 = 'darkgreen'; }else{ $online2 = 'darkred'; } 
       
       
        echo '
    <div class="manager">

    <div class="container">
                    <div class="left-side">
    <div class="c-box">
                                <div class="c-title red">'.$d['username'].'</div>
                                <div class="c-main">
            <div style=\'width: 64px; height: 81px; margin-top:-22px; margin-left:-10px; float: left; background: url(http://localhost/images/'.$d['look'].');\'>
                </div>
                <a href=\'/home/'.$d['username'].'\'><strong>'.$d['username'].'</strong></a><font color=\'grey\'> - '.$d['role'].'</font>                                      
                <div style=\'float: right; display: inline; margin-right: 10px;text-align: center;\'>
                    <div style=\'width: 48px; display: inline;height: 48px;margin-top: -9px;float: right; background: url(//xotel.co/swf/c_images/album1584/ADM.gif); background-position:center; background-repeat:no-repeat;\'>
                    </div><br />
                    <font color=\''.$online2.'\'><b>'.$online.'</b></font> 
                </div><br />
                <strong>Motto:</strong> '.$d['motto'].'<br>
    <strong>Last Online:</strong> '.date('d, M, Y', $d['last_online']).'    <br /><strong>Bans: </strong> | <strong>CFH\'s Responded: </strong> <br>                        
            </div>
        </div>
    </div></div></div>
        ';
    }
    ?> 
 <?php
    $q = LightShot::$MySQL->query("SELECT * FROM users WHERE rank = ? ORDER BY id ASC LIMIT 5", Array(10));
    while($d = $q->fetch()){
        if($d['online'] == 1){ $online = 'Online'; }else{ $online = 'Offline'; } 
        if($d['online'] == 1){ $online2 = 'darkgreen'; }else{ $online2 = 'darkred'; } 
       
       
        echo '
    <div class="manager">

    <div class="container">
                    <div class="left-side">
    <div class="c-box">
                                <div class="c-title red">'.$d['username'].'</div>
                                <div class="c-main">
              <div style=\'width: 64px; height: 81px; margin-top:-22px; margin-left:-10px; float: left; background: url(http://localhost/images/'.$d['look'].');\'>
                </div>
                <a href=\'/home/'.$d['username'].'\'><strong>'.$d['username'].'</strong></a><font color=\'grey\'> - '.$d['role'].'</font>                                      
                <div style=\'float: right; display: inline; margin-right: 10px;text-align: center;\'>
                    <div style=\'width: 48px; display: inline;height: 48px;margin-top: -9px;float: right; background: url(//xotel.co/swf/c_images/album1584/ADM.gif); background-position:center; background-repeat:no-repeat;\'>
                    </div><br />
                    <font color=\''.$online2.'\'><b>'.$online.'</b></font> 
                </div><br />
                <strong>Motto:</strong> '.$d['motto'].'<br>
    <strong>Last Online:</strong> '.date('d, M, Y', $d['last_online']).'    <br /><strong>Bans: </strong> | <strong>CFH\'s Responded: </strong> <br>                        
            </div>
        </div>
    </div></div></div>
        ';
    }
    ?> 
    <?php
    $q = LightShot::$MySQL->query("SELECT * FROM users WHERE rank = ? ORDER BY id ASC LIMIT 5", Array(9));
    while($d = $q->fetch()){
        if($d['online'] == 1){ $online = 'Online'; }else{ $online = 'Offline'; } 
        if($d['online'] == 1){ $online2 = 'darkgreen'; }else{ $online2 = 'darkred'; } 
       
       
        echo '
    <div class="admin">

    <div class="container">
                    <div class="left-side">
    <div class="c-box">
                                <div class="c-title red">'.$d['username'].'</div>
                                <div class="c-main">
             <div style=\'width: 64px; height: 81px; margin-top:-22px; margin-left:-10px; float: left; background: url(http://localhost/images/'.$d['look'].');\'>
                </div>
                <a href=\'/home/'.$d['username'].'\'><strong>'.$d['username'].'</strong></a><font color=\'grey\'> - '.$d['role'].'</font>                                      
                <div style=\'float: right; display: inline; margin-right: 10px;text-align: center;\'>
                    <div style=\'width: 48px; display: inline;height: 48px;margin-top: -9px;float: right; background: url(//xotel.co/swf/c_images/album1584/ADM.gif); background-position:center; background-repeat:no-repeat;\'>
                    </div><br />
                    <font color=\''.$online2.'\'><b>'.$online.'</b></font> 
                </div><br />
                <strong>Motto:</strong> '.$d['motto'].'<br>
    <strong>Last Online:</strong> '.date('d, M, Y', $d['last_online']).'    <br /><strong>Bans: </strong> | <strong>CFH\'s Responded: </strong> <br>                        
            </div>
        </div>
    </div></div></div>
        ';
    }
    ?> 
    <script src=
    "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type=
    "text/javascript">
    </script> 
    <script type="text/javascript">

    $('#admin').click(function(){
    $('.admin').fadeToggle('slow');
    $(this).toggleClass('green');
    });



    $(document).mouseup(function (e)
    {
    var container = $(".admin");

    if (!container.is(e.target) // if the target of the click isn't the container...
        && container.has(e.target).length === 0) // ... nor a descendant of the container
    {
        container.hide();
        $('#admin').removeClass('green');
    }
    });
    </script> 
    <script src=
    "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type=
    "text/javascript">
    </script>
</body>
</html>
 

Proximity

IDK?
Feb 13, 2014
673
56
curtsy of @JacobLucado I want to do that. I was using that before but if you click else where on the page the content disappears

I don't want it to disappear if you click else where but I want it if you click the other part of it
 

brandonj

Member
Dec 24, 2015
32
13
This?



Code:
    if (!container.is(e.target)
        && container.has(e.target).length === 0) // ... nor a descendant of the container
    { ...


to

    if (container.is(e.target)
        && container.has(e.target).length === 0) // ... nor a descendant of the container
    { ...
 

Proximity

IDK?
Feb 13, 2014
673
56
If you look on my origional code I have

Code:
                <b>Staff Ranks</b><br>
                - <a href="#founders" id="loginform">Founders</a><br>
                - <a href="#Manager" id="manager">Manager</a><br>
                - <a href="#Administrators" id="admin">Administrators</a><br>
                - <a href="#Moderators" id="mod">Moderators</a><br>
                - <a href="#Tmods" id="tmod">Trial Moderators</a><br>
                - <a href="#Events" id="event">Events Staff</a>

Than a bunch of php queries I want those to match those divs so foudners would go to founders and manager would go to manager.... etc get it
 
Anyone ?
 

Users who are viewing this thread

Top