$(document).ready(function(){ $('#searbtn').toggle(function(){ $('#search').animate({width:'206px'},function(){ $('#search').children('input').eq(0).animate({width:'131px'}) $('#search').children('input').eq(1).animate({width:'50px'}) }) $('#searbtn').html('') },function(){ $('#search').children('input').eq(0).animate({width:'0'},function(){ $('#search').children('input').eq(1).animate({width:'0'},function(){ $('#search').animate({width:'0'}) }) }) $('#searbtn').html('') }) $('.nav ul li').each(function(){ $(this).hover(function(){ $(this).children('.sed').stop().fadein() },function(){ $(this).children('.sed').stop().hide() }) }) $(".gotop").click(function(){ $('html , body').animate({scrolltop: 0},'slow'); }); }) function select(div){ $(div).on('click', '.placeholder', function(e) { var parent = $(this).closest(div); if (!parent.hasclass('is-open')) { parent.addclass('is-open'); $(div).not(parent).removeclass('is-open'); $('.is-open').not(parent).removeclass('is-open'); } else { parent.removeclass('is-open'); } e.stoppropagation(); }).on('click', 'ul>li', function() { var parent = $(this).closest(div); parent.removeclass('is-open').find('.placeholder').text($(this).text()); }); $('body').on('click', function() { $(div).removeclass('is-open'); $('.is-open').removeclass('is-open'); }); } function showimgdelay(imgobj,imgsrc,maxerrornum){ if(maxerrornum>0){ imgobj.onerror=function(){ showimgdelay(imgobj,imgsrc,maxerrornum-1); }; settimeout(function(){ imgobj.src=imgsrc; },500); maxerrornum=parseint(maxerrornum)-parseint(1); } }