一、關於children javascript
$(function(){ varconbg=["images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg","images/about/IMG_03.jpg"]; var tabl=jQuery(".content_r_yuan dl").children().length; var showtab=function(tab){ for(i=0;i<tab1;i++){ jQuery(".content_r_yuan dl").eq(i).hide(); jQuery(".content_r_bj ul").eq(i).hide(); jQuery(".p_desc").eq(i).hide(); } jQuery(".content_r_yuan dl").eq(tab).show(); jQuery(".content_r_bj ul").eq(tab).show(); jQuery(".p_desc").eq(tab).show(); } jQuery("#tabstabs dd").click(function(){ varindex=$(this).index();showtab(index); }) $(".content_r_yuan dl").eq(0).children().mouseover( function(){ var index=$(this).index(); $(this).children("a").addClass("hover1"); $(this).siblings().children("a").removeClass("hover1"); $(".p_desc").eq(0).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); } ); $(".content_r_bjul").eq(0).children("li").mouseover( function(){ var index=$(this).index(); $(".p_desc").eq(0).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); } ); $(".content_r_yuan dl").eq(1).children().mouseover( function(){ var index=$(this).index(); $(this).children("a").addClass("hover1"); $(this).siblings().children("a").removeClass("hover1"); $(".p_desc").eq(1).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); } ); $(".content_r_bjul").eq(1).children("li").mouseover( function(){ var index=$(this).index(); $(".p_desc").eq(1).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); } ); $(".content_r_yuan dl").eq(2).children().mouseover( function(){ var index=$(this).index(); $(this).children("a").addClass("hover1"); $(this).siblings().children("a").removeClass("hover1"); $(".p_desc").eq(2).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); } ); $(".content_r_bjul").eq(2).children("li").mouseover( function(){ var index=$(this).index(); $(".p_desc").eq(2).children("p").eq(index).show().siblings().hide(); $(".content_r_banner").css({"background":"url("+conbg[index]+")"}); }); });
二、關於背景焦點圖,一個老外須要兼容全部瀏覽器寬度,所以只能使用背景焦點圖,其實背景焦點圖也是能夠向左移動切換的。帶會兒再發
css
三、FLV視頻播放,我用的笑傲江湖的FLV播放器html
$(function(){ ajax("{'act':'is_rensheng'}"); if (amsg != ''){ $('#exam_video_r').html(amsg); } var fvideo = $("#fvideo").attr("value"); addVideoPlayer('video-area', 480, 360, { playlist: fvideo, autoPlay: 'true', repeatMode: 0 }); $(".exam_video_r_v li").click(function(){ var videolink=$(this).children("img").attr("rel"); var index=$(this).index(); $(".exam_video_r_t").html($(this).children("p").html()); $(".exam_video_r_n dl").eq(index).show().siblings().hide(); addVideoPlayer('video-area', 480, 360, { playlist: videolink, autoPlay: 'true', repeatMode: 0 }); }) });
四、騰訊彈窗,將騰訊彈窗改爲了Jquery版本,簡單,很簡單的自定義樣式,不用再用複雜的什麼artdialog等等。
CSS樣式
.layoutBg{width:100%;height:4250px;position:absolute;top:0;left:0;z-index:8888;display:none;background:url(http://mat1.gtimg.com/www/images/qq2012/alphabg.png);}
<script type="text/javascript">$(function(){ $(".pro_text li").click(function(){ var src=$(this).children("img").attr("rel"); $("#layoutBg").show(); $("#layoutBg").height(document.body.clientHeight); $("#login_frame").attr("src",src); $("#login_div").css({"left":"50%"}); $("#login_div").show(); }); });</script>
<div id="layoutBg" class="layoutBg"></div> <div id="login_div" style="position:fixed;_position:absolute;width:865px;height:555px;padding:0;margin:0;top:50%;left:-9999px;margin:-268px 0 0 -420px;z-index:9999;"> <iframe id="login_frame" height="100%" scrolling="auto" width="100%" frameborder="0" src=""></iframe> </div>
子頁面應該有個關閉按鈕,如何訪問父窗體元素呢?,下面是核心代碼,兼容全部瀏覽器咯
$("#diaclose").click(function(){ java
$("#login_div",window.parent.document).css({"left":"-9999px"}); ajax
$("#layoutBg",window.parent.document).hide(); 瀏覽器
});
太囧笑話網 ide