From b2bc62dadd4459f90d22cd12f925ca7ce2dae7d2 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Tue, 22 Jan 2013 12:19:32 +0800 Subject: [PATCH] fixed orbit bar that like nccu bar now, and add rails version in Gemfile --- Gemfile | 2 +- app/assets/javascripts/orbit-bar-search.js | 70 +++++++++++++--------- app/views/layouts/_orbit_bar.html.erb | 26 ++++---- 3 files changed, 57 insertions(+), 41 deletions(-) diff --git a/Gemfile b/Gemfile index 07a50937..98c341c9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'http://rubygems.org' -gem 'rails' +gem 'rails', "~> 3.2.9" gem "brakeman" gem 'mime-types' diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js index cc422b12..265cd92b 100644 --- a/app/assets/javascripts/orbit-bar-search.js +++ b/app/assets/javascripts/orbit-bar-search.js @@ -1,28 +1,42 @@ -$(document).on('click', '.orbit-bar-search', function (){ - if ($(this).parents('.search').hasClass('visible')){ - $(this).parents('.search').stop().animate({ - 'width':'28px', - },500); - $('.navbar-search').stop().animate({ - 'left':'30px', - 'opacity':'0', - },200); - $(this).parents('.search').css({ - 'background-color': 'transparent', - }); - $(this).parents('.search').removeClass('visible'); - } - else{ - $(this).parents('.search').stop().animate({ - 'width':'265px', - },200); - $('.navbar-search').stop().animate({ - 'left':'7px', - 'opacity':'1' - },500); - $(this).parents('.search').css({ - 'background-color': 'rgba(0, 0, 0, 0.5)', - }); - $(this).parents('.search').addClass('visible'); - } -}); \ No newline at end of file + +$(document).ready(function(){ + $('.search').tooltip({ + placement: "bottom" + }); +}); +$(document).on('mouseenter', '.orbit-bar-search', function (){ + $(this).parents('.search').stop().animate({ + 'width':'265px', + },200); + $('.navbar-search').stop().animate({ + 'left':'4px', + 'opacity':'1' + },500); + $(this).parents('.search').css({ + 'background-color': 'rgba(0, 0, 0, 0.5)', + }); + $(this).parents('.search').addClass('visible'); +}); + + +$(document).on('mouseleave', '.search.visible', function (){ + $(this).stop().animate({ + 'width':'28px', + },500); + $('.navbar-search').stop().animate({ + 'left':'30px', + 'opacity':'0', + },200); + $(this).css({ + 'background-color': 'transparent', + }); + $(this).removeClass('visible'); +}); + +$(document).on("mouseenter",".orbit-bar-language, .language-menu",function(){ + $(this).parents('.language').addClass("open") +}) + +$(document).on("mouseleave",".orbit-bar-language, .language-menu",function(){ + $(this).parents('.language').removeClass("open") +}) diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 36638302..7d20daf1 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -10,25 +10,19 @@