<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" /><meta http-equiv="X-UA-Compatible" content="IE=9" />
    <meta name="keywords" content="保险保函、电子保函、保证保险、保函开具、工程投标保证保险、建设合同履约保证保险、业主合同款支付保证保险、建设工程质量保证保险、建筑业企业人工工资支付保证保险、海关税保险、诉讼财产保全责任保险">
    <meta name="description" content="百联保是百川信（厦门）网络信息服务有限公司基于金融创新并响应“互联网＋”计划搭建的第三方金融服务平台。 ">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <title>百联保-产品中心</title>
    <link type="text/css" rel="stylesheet" href="<c:url value='/resources/version_new/css/basic.css' />" />
    <style>

    </style>
</head>
<body id="wert">
<jsp:include page="../../index/multi_h.jsp"/>

<div class="wert" style="position: relative;">
    <iframe id="frame3d" name="frame3d" frameborder="0" width="100%" height="100%" scrolling="auto"
            style="margin-top: -4px;" onload="setIframeHeight();"
            src="<c:url value='${url}' />" >
    </iframe>

    <div class="sder"></div>
</div>
<jsp:include page="../../index/multi_f.jsp"/>
<script type="text/javascript" src="<c:url value='/resources/version_new/js/jquery.min.js' />"></script>
<%--<script type="text/javascript" src="<c:url value='/resources/version_new/js/layer.js' />"></script>--%>
<script type="text/javascript" src="<c:url value='/resources/version_new/js/clipboard.min.js' />"></script>
</body>
</html>

<script>
    function setIframeHeight() {

        var iframe = document.getElementById('frame3d');
        if (iframe) {
            var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
            if (iframeWin.document.body) {
                iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
            }
        }


//        滚动条置顶
        $('html,body').animate({scrollTop:0},0);

        $('#frame3d').contents().find('ul#nav li a').click(function () {
            var s_index = $(this).parent().index();
            $('ul#nav-more li').eq(s_index).children('a').click();
            $("html, body").animate({
                scrollTop:  $('#frame3d').contents().find('.sed').eq(s_index).offset().top }, {duration: 400,easing: "swing"});
            return false;
        });



        if($('#frame3d').contents().find('.product-particulars').hasClass('sqe')){
            //分享
            $('.wert').append("<div id=\"link-share-more\" class=\"link-share\">"+$('#frame3d').contents().find(".link-share").html()+"</div>");
            //先隐藏掉
            $(top.document.body).find("#link-share-more").css({"display":"none"});


            //黑色蒙版
            $('.wert').append("<div id=\"link-mask-more\" class=\"link-mask\">"+$('#frame3d').contents().find(".link-mask").html()+"</div>");
            //先隐藏掉
            $(top.document.body).find("#link-mask-more").css({"display":"none"});

            //$("#tag").html()获取id为tag块儿的html然后添加到最上层页面中
            $('.wert').append("<div id=\"tag-top\" class=\"tag\">"+$('#frame3d').contents().find(".product-wed").html()+"</div>");

            //先隐藏掉
            $(top.document.body).find("#tag-top").css({"display":"none"});

            //添加导航栏分享
            $('#tag-top .wed-content').append("<div class=\"share-qwe\"></div>");


            $('#tag-top .wed-content ul li').click(function () {
                $('#tag-top .wed-content ul li').removeClass('current');
                $(this).addClass('current');
                var s_index = $(this).index();
                $("html, body").animate({
                    scrollTop:  $('#frame3d').contents().find('.sed').eq(s_index).offset().top }, {duration: 800,easing: "swing"});
                return false;
            })


            // 分享链接
            var s_url = window.location.href;

            var clipboard = new Clipboard('.sder', {
                text: function() {
                    return s_url;
                }
            });

            var clipboards = new Clipboard('.share-qwe', {
                text: function() {
                    return s_url;
                }
            });

            clipboard.on('success', function(e) {
                $('.link-share').show();
                $('.link-mask').show();
            });

            clipboards.on('success', function(e) {
                $('.link-share').show();
                $('.link-mask').show();
            });

            $('#link-close').click(function () {
                $('.link-share').hide();
                $('.link-mask').hide();
            });

            $('#link-zhi').click(function () {
                $('.link-share').hide();
                $('.link-mask').hide();
            });

            //点击购买，立即分享消失
            $('#frame3d').contents().find('a.insur-buy').click(function () {
                $('.sder').hide();
            })

//            $('.insur-buy').click(function () {
//                var s = ($('.insur-buy').attr('href'));
//                $('#frame3d').attr('src',s);
//            })
        }

        // 滚动轴滚动，导航栏出现
        $(window).scroll(function(){
            if($('#frame3d').contents().find('.product-particulars').hasClass('sqe')){
                var scrollt = document.documentElement.scrollTop + document.body.scrollTop; //获取滚动后的高度
                //通过高度判断切换子页面和上层页面的标签菜单的显示与否

                var s1_height = $('#frame3d').contents().find('.sed').eq(0).offset().top;
                var s2_height = $('#frame3d').contents().find('.sed').eq(1).offset().top;
                var s3_height = $('#frame3d').contents().find('.sed').eq(2).offset().top;
                var s4_height = $('#frame3d').contents().find('.sed').eq(3).offset().top;
                var s5_height = $('#frame3d').contents().find('.sed').eq(4).offset().top;
                var s6_height = $('#frame3d').contents().find('.sed').eq(5).offset().top;

                if(scrollt >= s1_height + 120)
                {
                    $(top.document.body).find("#tag-top").css({"display":"block"});
                    $("#frame3d").contents().find(".product-wed").css({"display":"none"});
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(0).addClass('current');
                }
                if(scrollt < s1_height + 120)
                {
                    $(top.document.body).find("#tag-top").css({"display":"none"});
                    $("#frame3d").contents().find(".product-wed").css({"display":"none"});
                }
                if(scrollt >= s2_height - 50){
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(1).addClass('current');
                }
                if(scrollt >= s3_height - 50){
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(2).addClass('current');
                }
                if(scrollt >= s4_height - 50){
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(3).addClass('current');
                }
                if(scrollt >= s5_height - 50){
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(4).addClass('current');
                }
                if(scrollt >= s6_height - 50){
                    $('.wed-content ul li').removeClass('current');
                    $('.wed-content ul li').eq(5).addClass('current');
                }
            }else{
                $(top.document.body).find("#tag-top").css({"display":"none"});
                $("#frame3d").contents().find(".product-wed").css({"display":"none"});
            }
        })

    }

</script>