Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sliding JQuery sidebar for mybb!
Author Message
euantor Offline
Posting Freak
*******
Support

Posts: 870
Joined: Jun 2009
Reputation: 7
Post: #1
Sliding JQuery sidebar for mybb!
Wishing you could have a sliding JQuery sidebar for MyBB just like ion IPB3 or vB4? Well, now you can with this super simple template edit!

We're going to be editing the index template, but you're first going to need to upload these two image files to your /images/ folder for MyBB.

[Image: arrowright.png] [Image: arrowleft.png]

Now, open the Index template and replace the whole thing with the following (unless you have plugins installed which edit the index template - in which case you'll have to add their stuff to it afterwards or just make careful edits.

PHP Code:
<html>
<
head>
<
title>{$mybb->settings['bbname']}</title>
{
$headerinclude}
<
script type="text/javascript">
<!--
    
lang.no_new_posts "{$lang->no_new_posts}";
    
lang.click_mark_read "{$lang->click_mark_read}";
// -->
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<style type="text/css">
.buttons {
    background: url(images/arrowleft.png) no-repeat;
    width: 16px;
    height: 16px;
    display: block;
    cursor: pointer;
}

.clickedbuttons {
    background: url(images/arrowright.png) no-repeat;
    width: 16px;
    height: 16px;
    display: block;
    cursor: pointer;
}
</style>
</head>
<body>
{$header}
<div style="float: right;">
<a id="button" class="buttons"></a>
</div>
<table>
<tr>
<td width="100%;" valign="top">
{$forums}
</td>
    <script type="text/javascript">
jQuery.noConflict();
    jQuery(function() {
        //run the currently selected effect
        function runEffect(){
            //get effect type from 
            var selectedEffect = 'slide';
            
            //most effect types need no options passed by default
            var options = {};
            //check if it's scale or size - they need options explicitly set
            if(selectedEffect == 'scale'){  options = {percent: 0}; }
            else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; }
            
            //run the effect
            jQuery("#effect").toggle(selectedEffect,options,500);

        };
        
        //set effect from select menu value
        jQuery("#button").click(function() {
            jQuery(this).toggleClass("clickedbuttons")
            runEffect();
            return false;
        });

    });
    </script>
<td valign="top">
<div id="effect" class="ui-widget-content ui-corner-all">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" width="240">
<tr>
<td class="thead">
<strong>Search</strong>
</td>
</tr>
<tr>
<td class="trow1">
<form method="post" 
action="{$mybb->settings['bburl']}/search.php">

<input type="hidden" name="action" value="do_search" />

<input type="hidden" name="postthread" value="1" />

<input type="hidden" name="forums" value="all" />

<input type="hidden" name="showresults" value="threads" />

<input type="text" class="textbox" name="keywords" value="" />

<!-- start: gobutton -->

<input type="submit" class="button" value="Go" />

<!-- end: gobutton -->

</form>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>


{$boardstats}

<dl class="forum_legend smalltext">
    <dt><img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" title="{$lang->new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
    <dd>{$lang->new_posts}</dd>

    <dt><img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" title="{$lang->no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
    <dd>{$lang->no_new_posts}</dd>

    <dt><img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" title="{$lang->forum_locked}" style="vertical-align: middle;" /></dt>
    <dd>{$lang->forum_locked}</dd>
</dl>
<br style="clear: both" />
{$footer}
</body>
</html> 


Simple eh? You now have a sliding sidebar which is toggled with a small graphic button. There are no conflicts with prototype or anything, so enjoy!

Here's a quick screenshot of the closed sidebar next tot he open one. Lovely eh? You can always add more to it too 001_smile

[Image: sidebar.png]
(This post was last modified: 07-07-2010, 06:27 PM by euantor)
07-07-2010, 06:22 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Mikers Offline
Tutorials Team Member
***

Posts: 141
Joined: Mar 2010
Reputation: 6
Post: #2
RE: Sliding JQuery sidebar for mybb!
Good looking script, gent. Simple and beautiful. And jQuery. Can rarely go wrong with jQuery. Big Grin

Good tut, thanks for adding it. 001_smile
07-07-2010, 07:36 PM
Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 870
Joined: Jun 2009
Reputation: 7
Post: #3
RE: Sliding JQuery sidebar for mybb!
No problem 001_smile The button looks awful, but you guys can easily make your own to fit with your themes =P
07-07-2010, 10:03 PM
Visit this user's website Find all posts by this user Quote this message in a reply
groovybluedog Offline
Member
***

Posts: 148
Joined: Feb 2010
Reputation: 0
Post: #4
RE: Sliding JQuery sidebar for mybb!
How can i make more bars on the sidebar that are empty, That i can place my own php and html codes in?
08-09-2010, 10:45 AM
Find all posts by this user Quote this message in a reply
Don+ Offline
Member
***

Posts: 68
Joined: Aug 2010
Reputation: 0
Post: #5
RE: Sliding JQuery sidebar for mybb!
Great guide. I might follow your points.
08-21-2010, 10:09 AM
Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 870
Joined: Jun 2009
Reputation: 7
Post: #6
RE: Sliding JQuery sidebar for mybb!
(08-09-2010 10:45 AM)groovybluedog Wrote:  How can i make more bars on the sidebar that are empty, That i can place my own php and html codes in?

Just add more divs with the content you want to add Big Grin

(08-21-2010 10:09 AM)Don+ Wrote:  Great guide. I might follow your points.

Thanks ^^
08-22-2010, 05:00 AM
Visit this user's website Find all posts by this user Quote this message in a reply
iamthehero Offline
Junior Member
**

Posts: 11
Joined: Dec 2010
Reputation: 0
Post: #7
RE: Sliding JQuery sidebar for mybb!
i will try this out Big Grin
12-05-2010, 05:21 AM
Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 870
Joined: Jun 2009
Reputation: 7
Post: #8
RE: Sliding JQuery sidebar for mybb!
Enjoy Tongue
12-05-2010, 06:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
flamehosts Offline
Member
***

Posts: 152
Joined: Oct 2010
Reputation: 1
Post: #9
RE: Sliding JQuery sidebar for mybb!
Very nice TUT
12-06-2010, 02:50 AM
Find all posts by this user Quote this message in a reply
Ryan Offline
Junior Member
**

Posts: 13
Joined: Dec 2010
Reputation: 0
Post: #10
RE: Sliding JQuery sidebar for mybb!
Excellent tutorial i must try this sometime
12-06-2010, 04:45 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)