Dynamic Menu Using JDock

Show Sleek and Dynamic Menu on the Visualforce Page.

jqdock is a jQuery plugin inspired by Mac .jqdock is a jQuery plugin inspired by Mac Dock Menu.

jqDock

 











Visualforce Page

<apex:page sidebar="false" showHeader="false" controller="JqueryController">
 <head>
   <style>
bPageHeader{
      display:none;
  }
  .heading{
      background-color:#ccc;
      text-align:center;
  }
  .data table,td,th {
      border:1px solid #000;
  }
  </style>
 <apex:includeScript value="{!$Resource.jquery}"/>
 <apex:includeScript value="{!$Resource.jqDock}"/>

 
<style type='text/css'> 
/*position and hide the menu initially - leave room for menu items to expand...*/
#page {padding-top:150px; padding-bottom:20px; width:100%;}
#menu {position:absolute; top:0; left:0; width:100%; display:none;}
/*dock styling...*/
/*...centre the dock...*/
#menu div.jqDockWrap {margin:0 auto;}
/*...set the cursor...*/
#menu div.jqDock {cursor:pointer;}
/*label styling...*/
div.jqDockLabel {font-weight:bold; font-style:italic; white-space:nowrap; color:Black
</style>
 
<script type='text/javascript'> 
jQuery(document).ready(function($){
  // set up the options to be used for jqDock...
  var dockOptions =
    { align: 'top' // horizontal menu, with expansion DOWN from a fixed TOP edge
    , labels: true  // add labels (defaults to 'bc')
    };
  // ...and apply...
  $('#menu').jqDock(dockOptions);
});
 
function setFrame(sr){
    fire(sr);
        
 
}
</script>
</head>
<apex:form >
 <body>
<div id='page'>
<div id="menu">
<apex:image value="{!$Resource.Clock}" onclick="setFrame('candidate')" title="Candidates" />
<apex:image value="{!$Resource.Connect}" onclick="setFrame('positions')" title="Connect"/>
<apex:image value="{!$Resource.Music}" onclick="setFrame('contact')" title="Music"/>
<apex:image value="{!$Resource.Pictures}" onclick="setFrame('account')"  title="Accounts"/>
<apex:image value="{!$Resource.Search}" onclick="setFrame('case')" title="Cases"/>
<apex:image value="{!$Resource.System}" onclick="setFrame('solution')" title="System"/>
<apex:image value="{!$Resource.Trash}" onclick="setFrame('applications')" title="Trash"/>
</div>
</div>
</body>
<apex:actionStatus startText="Retreving..." id="myStatus" startstyle="color:red;font-weight:bold;"/>
    
    <apex:outputPanel id="showstate">
    <center>
 
    <apex:dataTable id="pbtable" value="{!acc}" var="accvar" styleClass="tableClass" rowClasses="odd,even"  rendered="{!showtable}">
        <apex:facet name="header">Accounts</apex:facet>
           <apex:column styleClass="heading">
           <apex:facet name="header">Id</apex:facet>
           <apex:outputText value="{!accvar.Id}"/>
           </apex:column>

        <apex:column styleClass="heading">
           <apex:facet name="header">Name</apex:facet>
           <apex:outputText value="{!accvar.Name}"/>
           </apex:column>
           
           <apex:column styleClass="heading">
           <apex:facet name="header">Phone</apex:facet>
           <apex:outputText value="{!accvar.phone}"/>
           </apex:column>
           
           <apex:column styleClass="heading">
           <apex:facet name="header">Fax</apex:facet>
           <apex:outputText value="{!accvar.Fax}"/>
           </apex:column>
  </apex:dataTable>
    </center>
    </apex:outputPanel>
</apex:form> 
 <apex:form >
   <apex:actionFunction action="{!fire}" name="fire" rerender="showstate" status="myStatus"/>
 </apex:form>

</apex:page>


Controller


public class JqueryController
{
    public String tablename { get; set; }

    public Boolean showtable { get; set; }

        
     public Account[] acc {get;set;}
     
     public PageReference fire() 
     {
        showtable = true;
        acc = [select id,name,phone,fax from account limit 12];
        return null;
        
     }
     
     String uname;

    public String getUsername() {
        return uname;
    }
            
    public PageReference sayHello() {
        uname = UserInfo.getName();
        return null;
    }

}


Comments

Popular posts from this blog

Introduction to Salesforce Agent Script: Build Predictable AI Agents

Anti-Patterns in Salesforce Agentforce: What to Avoid When Building AI Agents

MCP vs. Traditional APIs: Choosing the Right Integration Approach