yp_common.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. $(function(){
  2. SwapTab(".swap-tab","li",".swap-content","ul","on");//通用Tab切换
  3. startmarquee('announ',22,1,500,3000);//头部滚动广告
  4. slide("#yp-slide","cur",447,201,1);//首页焦点图
  5. //通用select菜单
  6. $(".mouseover").each(function(i){
  7. var type = $(this).attr('type'),height = parseInt($(this).attr('heights')),position=parseInt($(this).attr('position')),
  8. navSub = $('.sub'+type+'_'+i);
  9. $(this).bind("mouseenter",function(){
  10. var offset =$(this).offset();
  11. if(navSub.css("display") == "none"){
  12. if(position==true){
  13. navSub.css({"position":"absolute","z-index":"100",left:offset.left,top:offset.top+height}).show();
  14. }else{
  15. navSub.show();
  16. }
  17. }
  18. }).bind("mouseleave",function(){
  19. navSub.hide();
  20. });
  21. navSub.bind({
  22. mouseenter:function(){
  23. navSub.show();
  24. },
  25. mouseleave:function(){
  26. navSub.hide();
  27. }
  28. })
  29. })
  30. //首页产品目录ie6支持
  31. if("\v"=="v") {
  32. if (!window.XMLHttpRequest) {
  33. var catitem = $(".cat-item");
  34. catitem.hover(function(){
  35. $(this).addClass("cat-item-hover");
  36. },function(){
  37. $(this).removeClass("cat-item-hover");
  38. })
  39. }
  40. }
  41. /*筛选菜单展开收起*/
  42. $("#PropSingle dd.AttrBox").each(function(){
  43. var len = $(this).children().length;
  44. if(len >10){
  45. $(this).before("<dd class='more cu'>全部展开</dd>");
  46. var category = $(this).children('a:gt(9)'),moreBtn = $(this).siblings(".more");
  47. category.hide();
  48. moreBtn.click(function(){
  49. if(category.is(":visible")){
  50. category.hide();
  51. moreBtn.removeClass("on").text("全部展开");
  52. }else{
  53. category.show();
  54. moreBtn.addClass("on").text("精简显示");
  55. }
  56. })
  57. }
  58. })
  59. $(".input").blur(function(){$(this).removeClass('input-focus');});
  60. $(".input").focus(function(){$(this).addClass('input-focus')});
  61. })