나는 끼워 넣어 진 영상의 옆에 Google + 코멘트 단면도를 추가하기 위하여 가정되는 wordpress plugin에 종사하고있다. javascript를 사용하여 처음에는 정확한 너비를 얻을 수 있지만 Iframe 문서에서 자동로드되는 스크립트는 브라우저 크기가 변경되면 크기를 100 % 너비로 자동 변경합니다 (이미지 참조). Iframe 아래의 문서에서 div에 액세스하여 크기를 조정할 때 원하는대로 변경하는 데 심각한 어려움이 있습니다.google + comments and javascript
after adjusting the browser size it jumps below and goes to 100% width.
나는 코멘트 섹션을 생성하는 thise 코드를 사용하고 있습니다 :
<script src="https://apis.google.com/js/plusone.js"></script>
<div id="comments"></div>
<script>
gapi.comments.render('comments', {
href: [URL],
width: 'comments_w',
first_party_property: 'BLOGGER',
view_type: 'FILTERED_POSTMOD'
});
"comments_w은"계산 된 변수 공간에 기초한 더 빠른 자바 스크립트 동영상의 너비가 계산 된 후
이
는 Iframe에이 폭을 제어 체내 사업부가있다 코멘트 DIV<iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 1138px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 616px;" tabindex="0" vspace="0" width="100%" id="I0_1480032087207" name="I0_1480032087207" src="https://apis.google.com/u/0/_/widget/render/comments?usegapi=1&href=http%3A%2F%2Fwww.cellcycle.net%2Ftemppage%2F&width=341&first_party_property=BLOGGER&view_type=FILTERED_POSTMOD&origin=http%3A%2F%2Fwww.cellcycle.net&search=&hash=&gsrc=3p&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.CUXyo_wPfp0.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCMYqx5cA6SdMRKSM5YaRVPo-xpcPg#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Cscroll%2Copenwindow&id=I0_1480032087207&parent=http%3A%2F%2Fwww.cellcycle.net&pfname=&rpctoken=30831408" data-gapiattached="true" title="Comment on this"></iframe>
#document == $0
<html est...>
</iframe>
내부 gnerated되고있다. 브라우저로 크기를 조정할 때마다 javascript로 액세스하고 크기를 변경하는 방법을 찾아야합니다. 이미 크기가 조정될 때마다 호출되는 기능이 있습니다. 나는 jQuery가 문서 안의 요소를 찾도록하는 데 어려움을 겪고있다.
iframe이 다른 원점에있는 경우 콘텐츠와 관련하여 아무 것도 할 수 없습니다. –