Remove pagination of iframe - javascript

I am using an iframe in my react app to display a pdf, but I want it to all be on one "page" there is a blank "border" separating each page that Id likes to remove entirely.
<div className="full-page">
<iframe title="doc" className="doc" src={file + '#toolbar=0' } frameborder="0" allowtransparency="true">
</iframe>
</div>
This is the CSS I have right now
.full-page {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
}
.doc {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

You have two options
One is to change the behavior of every Iframe PDF reader on the Planet, so on the right hand side I can make the gaps bigger or smaller even 0. Thus you need to convince Chromium and Mozilla to do likewise, or provide users with your own binary PDF extender. The Alternative on the Left is to make the Whole PDF one great long roll, since a PDF page can be infinit-ish, that should work practically for a few yards/meters. My longest were 5 mile diagrams at scale but by Jove they were slow to render/scroll.

Related

Why my loading gif makes my page to load slower?

I used some code to display a gif before my page load but it is
increasing my page's loading speed...
Here is where I use that code - http://sarkarinaukrihome.com/
JS
$(window).load(function() {
// Animate loader off screen
$(".se-pre-con").fadeOut("fast");;
});
HTML
<div class="se-pre-con"></div>
CSS
.no-js #loader {
display: none;
}
.js #loader {
display: block;
position: absolute;
left: 100px;
top: 0;
}
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url(Preloader_2.gif) center no-repeat #fff;
}
You must resize to the exact desired dimensions of your HTML container and compress all images.
If you look closely at your network flow, you lose a lot of time to load all the images.
If you analyze the performance of your website, Google Chrome gives you recommendations and you have precisely this point mentioned with the possible gain if you perform the suggested actions.
To use the LightHouse Viewer of Google Chrome, read this
For the theoretical concept of image compressing, you can read this
To compress different images, you can use services like this
You can see in the picture below the differents loading times of your website's files...
Your image quiz.png seems quite fat so it will take some time to load it...
As you just use it in a small format, you maybe should reduce its size ! ;)
Also, notes that your website is searching for some LOGO.png that it doesn't find ... ( doesn't really matters though )
With chrome's inspector :

How to create a centered popup of an element on another page

I come from a C# background so bear with me I already know the way I'm going about this isn't ideal:
But I need to do this:
Create a centered popup that scrolls with the page when the user clicks on some text the code must be embedded JavaScript in a HTML page(s), nothing server side (other than maybe css).
-preferably text links to popups need to be reusable I don't want to embed a bunch of code each for each link.
-I've looked at a lot of "pop-up" tutorials/exmaples but since I need embedded client side javascript it limits what works.
The result I would like to have a webpage with premade popups that I can reference from other webpages like OpenPopup(webpage.getElement(popupNumber12)) or have arrays with popup titles, descriptions that I can pass though.
Sounds like you're looking have to a modal rather than a popover since you don't want it to close after interacting with the page. I would just have a modal open with an onClick event and then describe its position as:
.modal {
width: 300px;
height: 300px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -150px;
}
Assuming the width of the modal you want to display is 300px.
If you're working with SCSS
$width = 300px
$height = 300px
.modal {
width: $width;
height: $height;
position: absolute;
left: calc(50% - $width)
top: calc(50% - $height)
}

Overlaying a Fixed Header Over Elements When Scrolling

I have a fixed header, so that when I scroll it remains at the top of the page so that visitors may navigate quickly or skip sections of the page.
Here is a picture of my problem:
The problem is pretty simple - I want my header to float over the top of any other objects instead of being hidden by them, but I assume there isn't a way to do it without javascript. Here is my CSS:
#primary header {
position: fixed;
margin: 0;
padding: 0;
width: 100%;
height: 50px;
background-color: rgb(49,49,49);
}
nav { /* positions nav menu */
position: fixed; /* keeps the nav bar fixed at top when scrolling */
top: 1.25%;
left: 27%;
}
nav a {
margin: 0 50px;
padding: 10px 20px;
font-size: 20px;
}
Anyway I can do this? I am not familiar with Javascript, but would love some help!
Set the css z-index property on your fixed element. The higher the value, most in front it will get...
Like:
#primary header {
z-index: 999; /* SET THE NEEDED AMOUNT */
}
The z-index property is a common solution to elements which are positioned, but it looks like YouTube has provided a solution as well.
Add a parameter to force YouTube iframe to set a low z-index.
If you have any element you’ll like to show above a YouTube iframe you just have to add a parameter to the iFrame URL.
Ricard Torres' Personal Blog
<iframe width="560" height="315" src="//www.youtube.com/embed/0HxNtWEIKhQ?wmode=transparent" frameborder="0" allowfullscreen></iframe>
JSFiddle didn't seem to reproduce the issue, but here is an example as well:
JSFiddle Example
StackOverflow Duplicate Question
YouTube API Documentation (Preferable Embedding Method)

Overflow-x on same browser, different platform

I have a jQuery slider which needs to be centered in my body; this slider acts as a changing background (fades into one another). I have no overflow problem on my computer (iMac), but on my nexus 7, my body is much wider to fit the whole image. In both cases, I have the latest version of Firefox.
Here's my CSS:
#grosse_photo {
position: absolute;
top: 0;
left: 50%;
margin-left: -552px;
height: 597px;
width: 100%;
max-width: 100%;
z-index: -1;
}
My images are all 1904px wide x 597px high.
I've tried making #grosse_photo relative and absolute position my images from there, but they don't center. I've also tried overflow-x: hidden to all elements (#grosse_photo, body and html) but don't seem to get anywhere.
If it helps any, this is the jQuery animation I'm using:
http://jonraasch.com/blog/a-simple-jquery-slideshow
It has served me well in the past, but this is the first time I'm using it as a background.

Make iframe expand/collapse

I have several apps inside iframes in the page that consolidates the apps (it acts as an app container).
I want to add a button somewhere that can expand and collapse the iframes to full size of the page.
The app now has a menu, header, footer, etc. and the application in iframe. When the user clicks say "+" button I want to expand the iframe to the full page and make everything else invisible. When they click it again I want to return to original size.
Maybe there is already something written that can make this happen, I tried to do some js on iframes and it seems hard to write browser independent code.
I can't use HTML5 since we need to support IE7.
An example.
Basically, just give your expanded iframe these CSS attributes,
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 10;
and it will fill its (relative) parent.
Source: "Full screen" <iframe>
You can use either traditional JS or jQuery to achieve this. jQuery is a JS library that is meant to allow cross-browser DOM handling in a sane way.
If I were you, I might code it as (using jQuery):
$('iframe#myid').click(function() {
$('iframe#' + current).removeClass('current');
$('iframe#myid').addClass('current');
var current = '#myid';
});
with the CSS code as:
body, iframe {
margin: 0px; //to normalize the default stylesheet applied by the browser
}
iframe.current {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 999;
}

Categories