Reply
Javascript Flippy Thing...
Old 07-29-2010, 10:18 PM Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I'm looking for something that functions like this (purple section) that is fairly easy to edit. I'm not even sure what to call it to Google for it! Anyone have an idea?
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
 
When You Register, These Ads Go Away!
Old 07-30-2010, 07:52 AM Re: Javascript Flippy Thing...
Extreme Talker

Posts: 174
Trades: 0
Look for tab controls. You'll probably use jquery.

http://jqueryui.com/demos/tabs/
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 07-30-2010, 08:41 AM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
You don't have to use jquery
http://www.modtalk.co.uk/article/c-a...gn/dhtml-tabs/

demo page
http://www.modtalk.co.uk/_site/code/...ipt/show-hide/
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 11:30 AM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Yeah, yeah! That's perfect!
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 02:39 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Soooo...
It doesn't work...
http://ts4.triplemoonsdesign.com/order.html
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 03:05 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I figured it out. The code they have you copy/paste is incorrect. The correct version can be pulled from the source code of their demo.
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 03:52 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
Correct, that's why I wrote the "Switch to code view" bit.

The backend renders HTML delimiters as &lt; & &gt;

Maybe I should add an instruction/warning to the overview window
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 04:03 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I would for dumb people like me!

Last edited by TripleMoons; 07-30-2010 at 04:05 PM..
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 04:14 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
Or I could write a handler/listener for a click event in the overview and switch to code view with have the text selected already .


The "clearing" problem is because the entire tab container is positioned absolute.

The container needs to be relative with the child tab pages as absolute so they can overlay each other.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-20-2010, 11:19 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I love your flippy code, Chris...But could you explain to me how to display it more then once on a page? Also is it possible to pull that Javascript out of the actual site and use an external file?

http://windygator.com/
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 04:21 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
You can put the javascript external with no problem at all.

To add another set of tabs is simply enough as well.

All it needs is for the tab button to have an ID of "t_idToShow" and the same JS will handle any amount of "boxes".
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 04:47 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Hmm. I did do the t_# id, but they don't seem to be working properly.

Code:
<div id="tabbox">
    <div id="tabbar">
        <div class="tab" id="t_one" onclick="show(this.id)">
        
            Topics
        
        </div>
        <div class="tab" id="t_two" onclick="show(this.id)">
        
            Archives
            
        </div>
    </div>
    <div class="cbox" id="two">
        
        <ul>                
            <?php wp_get_archives('type=monthly&show_post_count=1'); ?>
        </ul>
    
    </div>
    <div class="cbox" id="one">
                
        <ul>
            <?php wp_list_categories('orderby=name&show_count=1&title_li='); ?>
        </ul>

    </div>

</div>

<br /><br />

<div id="tabbox">
    <div id="tabbar">
        <div class="tab" id="t_three" onclick="show(this.id)">
        
            Posts
        
        </div>
        <div class="tab" id="t_four" onclick="show(this.id)">
        
            Comments
            
        </div>
    </div>
    <div class="cbox" id="three">
                
        
    
    </div>
    <div class="cbox" id="four">
                
        <ul>
            <?php wp_list_comments(); ?>
        </ul>

    </div>

</div>
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 04:57 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
what does it do or not do, as the case maybe
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 05:08 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
The second box, which a tab is clicked on, jumps up to where the first box is and replaces part of it. You have to see it, I don't know how to describe it. http://windygator.com/
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 05:47 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
That's the "HideAll()" function collapsing all the boxes with the same class name.

To use two separate sets, you need to differentiate between each group when hiding the boxes.
The classname can be passed through in the show function and on through to the "HideAll()" function to replace the hardcoded variable.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 05:57 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
How about you explain that as if I don't have the faintest idea how Javascript works (because I don't).
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 06:35 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
in the tab button

HTML Code:
<div class="tab" id="t_tabz" onclick="show(this.id,'classZ')">Z</div>
........
On the boxes
HTML Code:
<div class="classZ" id="tabZ">This is box for tab Z</div>
.......
And th JS

Code:
<script type="text/javascript">
function show(p_oID,class) {
var objID = p_oID.replace("t_","");
	hideAll(class);
	document.getElementById(objID).style.visibility = "visible";
	document.getElementById(objID).style.display = "block";
}

function hideAll(class) {
	var cBoxes = getElementsByClassName(class);
	for (var i=0;i < cBoxes.length; i++) {
		cBoxes<i>.style.visibility = "hidden";
		cBoxes<i>.style.display = "none";
	}
}
function getElementsByClassName(class) {
    var a = ;
    var re = new RegExp("\b" + class+ "\b");
    var els = document.getElementsByTagName("div");
    for(var i=0;i < els.length; i++)
        if(re.test(els<i>.className))a.push(els<i>);
    return a;
}
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-23-2010, 11:30 AM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Does this mean each section has to have their own Javascript?
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-23-2010, 12:05 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 568
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I'm looking at this and I just don't understand.
TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-25-2010, 12:56 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Super Moderator

Posts: 32,316
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by TripleMoons View Post
Does this mean each section has to have their own Javascript?
The same javascript runs it all.

I shall create an example of two independant tabs -





Watch this space
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Javascript Flippy Thing...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.21026 seconds with 13 queries