Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-07-2012, 06:39 AM   PM User | #1
danielzd
New to the CF scene

 
Join Date: Nov 2012
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
danielzd is an unknown quantity at this point
Showing a hidden content page

I have the following code that hides a content page on click of the menu to show a google maps in the background. I would like to modify it so that on click, the content page is shown along with the google maps background.


Code:
					$bf_menu_items.bind('click', function(e) {
						var $item	= $(this);
						
						hidePageContent();
						
						var item	= $(this).data('content');
						if(item === 'visit') {
							BGMap.showMap();
						} else{
							$.when( BGImageController.fadeBG(true) ).done(function(){
								BGMap.hideMap();
							});
							$('#' + $item.data('content')).show();
						}	
						return false;
					});
Thanks in advance!

Last edited by danielzd; 11-07-2012 at 07:15 AM..
danielzd is offline   Reply With Quote
Old 11-07-2012, 03:10 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
without knowing anything about the other functions on your page or the html, I'll guess that you just need to remove "hidePageContent();" so it doesnt hide the contentpage?

Code:
$bf_menu_items.bind('click', function(e) { 
e.preventDefault();
var $itemContent = $(this).data('content'); 
if($itemContent === 'visit') { 
        BGMap.showMap();
 } else { 
        $.when( BGImageController.fadeBG(true) ).done(function(){ 
         BGMap.hideMap(); 
          }); 
         $itemContent.show(); 
 }	
});
I refined your code as well as removed hidecontentpage

- you are using jQuery alreayd so i remove the return false in favor of e.preventDefault()
- you were never really using $item for anything so I did things a little differently.
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users

Last edited by DanInMa; 11-07-2012 at 03:13 PM..
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
danielzd (11-07-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 +1. The time now is 06:27 AM.


Advertisement
Log in to turn off these ads.