Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-22-2015, 07:07 AM
Dave Strider's Avatar
Dave Strider Dave Strider is offline
 
Join Date: Sep 2011
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Keep div hidden on different page

I currently have this code:
Code:
$(document).ready(function(){
    $("#hide").click(function(){
        $("#menu").hide(500);
    });
    $("#show").click(function(){
        $("#menu").show(500);
    });
});
What I would like to do is for it to remember the users selection. Essentially if the user is on the home page and chooses to hide the menu, it will stay hidden while they are on a different page.
Reply With Quote
Благодарность от:
the one
  #2  
Old 02-22-2015, 08:33 AM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what you need is an Oreo =)
take a look at this, seems you understand what you're doing. So im going to point you in the right direction
Double Stuffed Oreo's
Chocolate Chip Cookies
Reply With Quote
  #3  
Old 02-22-2015, 11:13 PM
Dave Strider's Avatar
Dave Strider Dave Strider is offline
 
Join Date: Sep 2011
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dr.CustUmz View Post
what you need is an Oreo =)
take a look at this, seems you understand what you're doing. So im going to point you in the right direction
Double Stuffed Oreo's
Chocolate Chip Cookies
I have no clue what I'm doing with jQuery. I found this code online lol.
Reply With Quote
  #4  
Old 02-23-2015, 03:50 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is something what you're looking for, I use this on my forum as an alternative to the confusing templates that is used within vB3. You can alter this to suit your needs

Code:
$(document).ready(function() {
// LEFT COLUMN:
	// When the collapse button is clicked:
	$('.collapseLeft_20').click(function() {
		$('.collapseLeft_20').css("display","none");
		$('.expandLeft_20').css("display","block");
		$('#leftCol_20').css("display","none");
		$.cookie('leftCol_20', 'collapsed');
	});
	// When the expand button is clicked:
	$('.expandLeft_20').click(function() {
		$('.expandLeft_20').css("display","none");
		$('.collapseLeft_20').css("display","block");
		$('#leftCol_20').css("display","block");
		$.cookie('leftCol_20', 'expanded');
	});
// COOKIES
	// Left column state
	var leftCol_20 = $.cookie('leftCol_20');
	// Set the user's selection for the left column
	if (leftCol_20 == 'collapsed') {
		$('.collapseLeft_20').css("display","none");
		$('.expandLeft_20').css("display","block");
		$('#leftCol_20').css("display","none");
	};
});
Reply With Quote
Благодарность от:
Dr.CustUmz
  #5  
Old 02-24-2015, 02:08 AM
Dave Strider's Avatar
Dave Strider Dave Strider is offline
 
Join Date: Sep 2011
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by greigeh View Post
Here is something what you're looking for, I use this on my forum as an alternative to the confusing templates that is used within vB3. You can alter this to suit your needs

Code:
$(document).ready(function() {
// LEFT COLUMN:
	// When the collapse button is clicked:
	$('.collapseLeft_20').click(function() {
		$('.collapseLeft_20').css("display","none");
		$('.expandLeft_20').css("display","block");
		$('#leftCol_20').css("display","none");
		$.cookie('leftCol_20', 'collapsed');
	});
	// When the expand button is clicked:
	$('.expandLeft_20').click(function() {
		$('.expandLeft_20').css("display","none");
		$('.collapseLeft_20').css("display","block");
		$('#leftCol_20').css("display","block");
		$.cookie('leftCol_20', 'expanded');
	});
// COOKIES
	// Left column state
	var leftCol_20 = $.cookie('leftCol_20');
	// Set the user's selection for the left column
	if (leftCol_20 == 'collapsed') {
		$('.collapseLeft_20').css("display","none");
		$('.expandLeft_20').css("display","block");
		$('#leftCol_20').css("display","none");
	};
});
It still appears when going to a new page even if it was hidden on the previous one.
Reply With Quote
  #6  
Old 02-24-2015, 07:01 AM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

did you modify it to fit your classes? take the time to read the links i shared, get an understanding of what you're trying to accomplish, you should have no issue adapting grieg's code.

http://stackoverflow.com/questions/1...ie-with-jquery

if your looking more for a "will you do it for me" and not actually wanting to learn anything, share your template
Reply With Quote
  #7  
Old 02-24-2015, 10:49 AM
Dave Strider's Avatar
Dave Strider Dave Strider is offline
 
Join Date: Sep 2011
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dr.CustUmz View Post
did you modify it to fit your classes? take the time to read the links i shared, get an understanding of what you're trying to accomplish, you should have no issue adapting grieg's code.

http://stackoverflow.com/questions/1...ie-with-jquery

if your looking more for a "will you do it for me" and not actually wanting to learn anything, share your template
Well I just solved the issue. I forgot to include jquery.cookie.js file. I probably should have double checked to see if that was included. Honest mistake really. Thanks for the help!
Reply With Quote
2 благодарности(ей) от:
Dr.CustUmz, greigeh
  #8  
Old 02-24-2015, 07:35 PM
greigeh greigeh is offline
 
Join Date: Jan 2015
Posts: 113
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry I should really have mentioned you needed that file! Glad you got it to work though.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09122 seconds
  • Memory Usage 2,241KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (4)post_thanks_box_bit
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete