How to do I decrease font size for the content in page viewer web part in sharepoint

I'm calling a web page from page viewer web part but the content font size is big and want to make it smaller. I used below javascript in Scripteditor web part but that is not working. Below is the script

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
window.onload = function() {
$('p', $('MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');//MSOPageViewerWebPart_WebPartWPQ5 is the ID property of my iframe
};
</script>
buzzme123Asked:
Who is Participating?
 
Rainer JeschorCommented:
Hi,
have not yet tested this, but the id selector is wrong and should be:
jQuery('p', $('#MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');

Open in new window

If this is still not working, you perhaps have to attach a event handler to the iframe load event so that the text size change is running after the iframe is loaded.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
 <script type="text/javascript">
jQuery(document).ready(function() {
  jQuery('#MSOPageViewerWebPart_WebPartWPQ3').bind('load', function() { 
  $('p', $('MSOPageViewerWebPart_WebPartWPQ3').contents()).css('fontSize','3pt');
 });
});
 </script> 

Open in new window


Which SharePoint version and edition?
Thanks and HTH
Rainer
0
 
buzzme123Author Commented:
first one did not work. I'm using SharePoint 2013 version. I will try the second one.
0
 
buzzme123Author Commented:
Don't know why. I tried the second one and it did not work either. I'm going to try on a different page and see if that works or not.
0
 
buzzme123Author Commented:
By the way I'm using scripteditor webpart to have this code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.