Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 614
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?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
 
Register now for full access!
Old 07-30-2010, 08:52 AM Re: Javascript Flippy Thing...
Extreme Talker

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

http://jqueryui.com/demos/tabs/
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 07-30-2010, 09:41 AM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 12:30 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Yeah, yeah! That's perfect!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 03:39 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Soooo...
It doesn't work...
http://ts4.triplemoonsdesign.com/order.html
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 04:05 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 07-30-2010, 04:52 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 05:03 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

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

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


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

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 12:19 AM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
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/
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 05:21 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 05:47 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
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>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 05:57 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 06:08 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
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/
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 06:47 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-21-2010, 06:57 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
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).
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-21-2010, 07:35 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-23-2010, 12:30 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Does this mean each section has to have their own Javascript?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-23-2010, 01:05 PM Re: Javascript Flippy Thing...
TripleMoons's Avatar
Webmaster Talker

Posts: 614
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
I'm looking at this and I just don't understand.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-25-2010, 01:56 PM Re: Javascript Flippy Thing...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,505
Name: Chris Hirst
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
Thought for today:- I SEO the only industry where all the cowboys are Indians?
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 1.53259 seconds with 12 queries