/*--------------------------------------------------------------------- Template Name: lim.it Version: 1.0 Release Date: July 12, 2010 File: lim.it.js Updated: 2010-07-12 Copyright (c) 2010 Chanry Ian - http://wcweb.us ----------------------------------------------------------------------- WARNING! DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING! ---------------------------------------------------------------------*/ // globle use // sometime you can preload some images // imageObj = new Image(); // imgs = ["/static/style/img/toggle.gif", "/static/style/img/nyro/ajaxLoader.gif", "/static/style/img/nyro/prev.gif", "/static/style/img/nyro/next.gif"]; // for (i = 0; i <= imgs.length; i++) imageObj.src = imgs[i]; // lim object setup if(!Limit) var Limit = {} Limit.scrollToTop = function(e){ $(e).hide().removeAttr("href"); if ($(window).scrollTop() != "0") { $(e).fadeIn("slow") } var scrollDiv = $(e); $(window).scroll(function () { if ($(window).scrollTop() == "0") { $(scrollDiv).fadeOut("slow") } else { $(scrollDiv).fadeIn("slow") } }); $(e).click(function () { $("html, body").animate({ scrollTop: 0 }, "slow") }) } Limit.setup = function () { // Open external link in new windows $('a[href^="http://"]').filter(function () { return this.hostname && this.hostname !== location.hostname; }).attr('target', '_blank'); // build an animated footer $('#animated').each(function () { $(this).hover(function () { $(this).stop().animate({ opacity: 0.9 }, 400); }, function () { $(this).stop().animate({ opacity: 0.0 }, 200); }); }); // scroll to top on request if ($("a#totop").length) Limit.scrollToTop("a#totop"); // setup content boxes if ($(".content-box").length) { $(".content-box .head").css({ "cursor": "s-resize" }); $(".content-box .body").slideUp(); // Give the header in content-box a different cursor $(".content-box .head").toggle( function () { var that=this; $(this).parent().find('.body').slideDown('slow',function(){ $(that).find('.caption').toggleClass("content-box-closed"); }); // Toggle the content },function(){ var that=this; $(this).parent().find('.body').slideUp('slow',function(){ $(that).find('.caption').toggleClass("content-box-closed"); }); // Toggle the content }); } // custom tooltips to replace the default browser tooltips for
and //$("a[title], div[title], span[title]").tipTip(); // if($('.dropdown-toggle').length){ // $('.dropdown-toggle').dropdown(); // } if($(".collapse").length){ //$(".collapse").collapse(); } } $(document).ready(function () { Limit.setup(); }); if($('#list-grid-toggle').length){ $('.list-toggle-btn').click(function(e){ if($(e.currentTarget).hasClass("list-toggle-btn-up")){ $(e.currentTarget).toggleClass("list-toggle-btn-on list-toggle-btn-up"); $('.grid-toggle-btn').toggleClass("grid-toggle-btn-on grid-toggle-btn-up"); $('#list-grid-toggle').addClass("videolist-heng"); } e.preventDefault(); }); $('.grid-toggle-btn').click(function(e){ if($(e.currentTarget).hasClass("grid-toggle-btn-up")){ $('.list-toggle-btn').toggleClass("list-toggle-btn-on list-toggle-btn-up"); $(e.currentTarget).toggleClass("grid-toggle-btn-on grid-toggle-btn-up"); $('#list-grid-toggle').removeClass("videolist-heng"); } e.preventDefault(); }); } $(function () { $('.toggle-info').slideUp('fast'); $('.toggle-info-btn').toggle( function () { var that = this; $("#" + $(this).attr('rel')).slideDown( 'slow', function () { $(that).children().html('隐藏信息'); } ); }, function () { var that = this; $("#" + $(this).attr('rel')).slideUp( 'fast', function () { $(that).children().html('显示信息'); } ); } ) }); (function (doc) { var addEvent = 'addEventListener', type = 'gesturestart', qsa = 'querySelectorAll', scales = [1, 1], meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; function fix() { meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; doc.removeEventListener(type, fix, true); } if ((meta = meta[meta.length - 1]) && addEvent in doc) { fix(); scales = [.25, 1.6]; doc[addEvent](type, fix, true); } }(document)); function is_ie(){ return /MSIE/g.test(window.navigator.userAgent); } //Plugin start (function($) { var methods = { init : function( options ) { return this.each(function() { var _this=$(this); _this.data('marquee',options); var _li=$('>li',_this); _this.wrap('
') .height(_this.height()) .hover(function(){if($(this).data('marquee').stop){$(this).stop(true,false);}}, function(){if($(this).data('marquee').stop){$(this).marquee('slide');}}) .parent() .css({position:'relative',overflow:'hidden','height':$('>li',_this).height()}) .find('>ul') .css({width:screen.width*2,position:'absolute'}); for(var i=0;ili',$this).width()*-1}, $this.data('marquee').duration, 'swing', function() { $this.css('left',0).append($('>li:first',$this)); $this.delay($this.data('marquee').delay).marquee('slide'); } ); } }; $.fn.marquee = function(m) { var settings={ 'delay':2000, 'duration':900, 'stop':true }; if(typeof m === 'object' || ! m) { if(m){ $.extend( settings, m ); } return methods.init.apply( this, [settings] ); } else { return methods[m].apply( this); } }; } )( jQuery ); //Plugin end //call $(document).ready( function(){$('.slide').marquee({delay:3000});} ); $(window).on('load resize', function(){ if (getInternetExplorerVersion() != 8.0) { var height = $(document).height() - $('#header').height() - $('#footer').height(); $('.app-sidebar').height(height - 32); } }); function getInternetExplorerVersion() // Returns the version of Internet Explorer or a -1 // (indicating the use of another browser). { var rv = -1; // Return value assumes failure. if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat(RegExp.$1); } return rv; } $(function () { if ($("#nav-category").length) { $(".nav-list:first a").click(function (e) { if ($(e.currentTarget).attr("data-target") !== undefined) { //be fix at start with in $(".nav-list:first .nav-list .in").collapse("toggle"); $(".nav-list:first .nav-list .collapse").filter(".in").collapse("hide"); } }) } }); $(document).ready( function () { if ($(".flash_messages").children().filter("p").html() !== "message-here") { $(".flash_messages").fadeIn(); } } ); window.flash = function flash(str) { var temp = $(".flash_messages").first().clone(true); $(temp).children().filter("p").html(str); $(".flash_messages").last().before($(temp)); $(temp).fadeIn(); setTimeout(function () { $(temp).fadeOut(); }, 10000); } //window.alert = function alert(str) { // flash(str); //}