Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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 08:15 AM.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    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.
    Last edited by DanInMa; 11-07-2012 at 04:13 PM.

  • Users who have thanked DanInMa for this post:

    danielzd (11-07-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •