Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*!
- * Jquery Navigation
- */
- $(function() {
- var Menu = {
- Bind: function()
- {
- $(window).resize(this.AdjustView);
- $('.file_buttons').on('click', o.FileBrowseAction);
- $('input[type="file"]').on('change', o.FileBrowse);
- $('.mainmenu-toggle').on('click', o.MenuToggle);
- $('.sf-menu').bind('resize', this.ScrollAdjust);
- o.AdjustView();
- },
- ScrollAdjust: function()
- {
- var height = $(window).height();
- },
- MenuToggle: function()
- {
- if( $('body').hasClass('menu-toggle') )
- {
- $('body').removeClass('menu-toggle');
- $('body').addClass('opened');
- } else {
- $('body').addClass('menu-toggle');
- $('body').removeClass('opened');
- }
- },
- AdjustView: function()
- {
- o.width = $(window).width();
- o.height = $(window).height();
- if( o.width > 765 )
- {
- $('.navbar .navbar-header').css("width","240px");
- if( $('body').hasClass('menu-toggle') )
- {
- $('body').removeClass('menu-toggle');
- }
- } else {
- $('.navbar .navbar-header').css({
- width: 'auto',
- height: '50px',
- overflow: 'hidden',
- });
- if( $('body').hasClass('opened') )
- {
- return;
- }
- if( ! $('body').hasClass('menu-toggle') )
- {
- $('body').addClass('menu-toggle');
- }
- }
- },
- init: function()
- {
- o = $.extend({}, this);
- o.Bind();
- }
- }
- $.fn.Menu = function(){
- return this.each(function(){
- var menu = Object.create(Menu);
- menu.init();
- });
- }
- });
- $(function() {
- var Navigation = {
- bindEvents: function()
- {
- $li = o.navigation.children('li');
- $sel = $li.children('ul').prev('a').addClass('dropdown');
- $sel.bind('click', this.toggleNav)
- .append('<span class="fa fa-angle-right normal"></span>');
- },
- toggleNav: function( e )
- {
- e.preventDefault();
- $this = $(this);
- if($this.hasClass('dropdown'))
- {
- o.show($this);
- console.log(o.navigation.height());
- }
- },
- show: function( $li )
- {
- $ul = $li.next('ul');
- if( $ul.hasClass('active') ) {
- $ul.slideUp('fast').removeClass('active');
- $ul.prev('a').removeClass('active').children('span').removeClass('rotate');
- }
- else {
- o.destroy();
- $ul.prev('a').addClass('active');
- $ul.prev('a').children('span').addClass('rotate');
- o.$active = $ul.slideDown('fast').addClass('active');
- }
- },
- destroy: function()
- {
- $(o.$active).prev('a').removeClass('active');
- $(o.$active).prev('a').children('span').removeClass('rotate');
- $(o.$active).slideUp('fast').removeClass('active');
- },
- init: function() {
- o = $.extend({}, this);
- o.navigation = $('.sf-menu');
- o.bindEvents();
- },
- }
- $.fn.Navigation = function(){
- return this.each(function(){
- var nav = Object.create(Navigation);
- nav.init();
- });
- }
- });
- $(function() {
- var Dreamline = {
- bind: function()
- {
- o.add_family_details.on('keyup', o.addNominee);
- o.add_applicant_name.on('keyup', o.addBankAccountName);
- },
- addNominee: function()
- {
- $this = $(this);
- var html = "";
- ===============================
- // Please refer image for Result
- ===============================
- $.each(o.add_family_details, function(index, val) {
- var option = $(val).val();
- if( option.length )
- html += '<option value="' + index + '">' + $(val).val() + '</option>';
- });
- $('select[name="nominee_id"]').html(html);
- },
- addBankAccountName: function()
- {
- var text = $(this).val();
- $('input[name="bank_account_name"]').val(text);
- },
- init: function()
- {
- var o = $.extend({}, this);
- o.add_family_details = $('.family_details');
- o.add_applicant_name = $('input[name="applicant_name"]');
- o.addNominee();
- o.bind();
- }
- }
- $.fn.Dreamline = function(){
- return this.each(function(){
- var dream = Object.create(Dreamline);
- dream.init();
- });
- }
- });
- jQuery(document).ready(function($) {
- $(document).Menu();
- $(document).Navigation();
- $(document).Dreamline();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement