Making an iframe slideshow for webpages with jQuery - html

I'm trying to make a slideshow on my webpage that will iterate through a list of html projects and showcase them using an iframe. I'm stuck on how to make the loop that will change the src each time and open the new project.
This is the code I've been able to come up with:
<div class="buttns">
<button id="previous" type="button"><</button>
<div>
<iframe
style="
width: 480px;
height: 270px;
position: relative;
left: 0px;
top: 0px;
overflow: hidden;
"
frameborder="0"
type="text/html"
src=""
width="100%"
height="100%"
allowfullscreen
>
</iframe>
</div>
<button id="next" type="button">></button>
</div>
<script type="text/javascript">
$("#next").click(function () {
$("#p_elem").attr("src", function (data) {
var webpages = [
"../Wolfie873.github.io/Test Projects/DissapearingCircles.html",
"../Wolfie873.github.io/Test Projects/GuessTheNumber.html",
"../Wolfie873.github.io/Test Projects/TestReaction.html",
];
for (var i = 0; i < webpages.length; i++) {
return webpages[i];
}
});
});
</script>
If someone can point me in the right direction, I would greatly appreciate it as I am new to coding.

Related

Add a link to vimeo video on Shopify

On our site, we use vimeo to display a carousel video of "signature styles" on our homepage. I would like to add a link so that when you click this video, it will direct you the a "signature styles" page.
I am new to using liquid/shopify. I know how to do this in HTML, but it doesn't appear to be working like I thought.
Here is the original code in the "background-video.liquid" file:
<section class="Section" id="section-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="background-video" data-section-settings='{{ section_settings }}'>
<div class="ImageHero {% if section.settings.section_size != 'normal' %}ImageHero--{{ section.settings.section_size }}{% endif %}">
<div class="ImageHero__VideoHolder"></div>
</div>
</section>
And here is some code I tried to replace the above lines with:
<a href="https://www.clarasunwoo.com/search?q=signature+styles&type=product">
<div style="padding:56.25% 0 0 0;position:relative;">
<iframe src="https://vimeo.com/540236561" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
</div><script src="https://player.vimeo.com/api/player.js"></script>
</a>
All you need to do is create an overlay div that "blocks" the actual iframe from being interacted with via z-index. You can then use JavaScript to handle the click and redirection of the user.
<div style="padding: 56.25% 0 0 0; position: relative">
<iframe
src="https://vimeo.com/540236561"
style="
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
"
frameborder="0"
allow="autoplay; fullscreen"
allowfullscreen
></iframe>
<div class="overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 99;"></div>
</div>
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
const overlay = document.querySelector(".overlay");
overlay.onclick = function () {
window.location.href = "https://www.clarasunwoo.com/search?q=signature+styles&type=product";
};
</script>

How to hover over text (later a link) and have image and text next to it show up

I have a simple webpage with "site map" on bottom that won't be implemented for weeks or months and am developing the rest as I go.
So, "Site Map" needs to be a link (I presume) with "href=" (?) where I can add a link later? Upon hover, I need text saying "coming soon" to show up, along with an image on both sides, i.e.
(before hover)
Site Map
(after hover)
Site Map Coming Soon
There should be a little space between the pic and text that pops up.
#my_map:hover:after {
margin-left: 20px;
color: green;
content: "(Coming Soon)";
}
<h1>Before and After Tag Example</h1>
<p id="my_map">Site Map</p>
<p>Go back to Main Menu</p>
<span> <img src="lightening_bolt" alt="bolt" height="20" width="20";> coming soon <img src="lightening_bolt" alt="bolt" height="20" width="20";> </span>
<p style "margin-top: 50px;">Hover over Site Map... </p>
Above isn't allowing for an image, just content= some text, and all the searching I've done to find some code ideas seem to be with other objectives...
You can add an image to the content of an :after pseudo element by using the url() attribute. If you want text as well as an image, you need to string these together without a space. If you want space between the image and the text, just be sure to include the spaces withing your text string. The snippet below shows an image placed before and after the string.
Note: the images take a second or two to load.
var myMap = document.getElementById("my_map2");
var comingSooon = document.getElementById("my_map2");
//
myMap.addEventListener("mouseover", function() {
cs.innerHTML = "<img src='https://picsum.photos/200' height='15' width='40' /> (Coming Soon) <img src='https://picsum.photos/200' height='15' width='40' />";
}, false);
//
myMap.addEventListener("mouseout", function() {
cs.innerHTML = "";
}, false);
#my_map:hover:after {
margin-left: 20px;
font-size: 20px;
color: green;
content: url("https://picsum.photos/20")" (Coming Soon) "url("https://picsum.photos/20");
}
<p id="my_map">Site Map</p>
<p>Site Map 2 <span id="cs"></span></p>
You could also just have the image already there and hide it until the anchor is hovered over:
#map-link {
display: inline-block;
}
#hidden-message {
display: none;
transition: display 1s linear;
}
#map-link:hover+#hidden-message {
display: block;
}
#cmg-soon-img {
margin: 0;
padding: 0;
height: 100px;
width: 100px;
}
<div id="my_map">
<p id="map-link">Site Map</p>
<div id="hidden-message">
<img id="cmg-soon-img" src="https://picsum.photos/20">
<p>
"Coming soon..."
</p>
</div>
</div>
Which would allow you to control the width and height of the image shown.
<!-- Here's what I got (hope answer my own question doesn't close thread...-->
<!DOCTYPE html>
<html>
<head>
<style>
#my_map {
margin-right: 30px;
font-size: 35px;
text-decoration: none;
}
</style>
</head>
<body>
<p>Site Map <span id="cs"></span></p>
<script>
var myMap = document.getElementById("my_map");
var comingSooon = document.getElementById("my_map");
myMap.addEventListener("mouseover", function() {cs.innerHTML = "<img src='https://picsum.photos/20' height='35' width='35' /> (Coming Soon) <img src='https://picsum.photos/20' height='35' width='35' />";}, false);
myMap.addEventListener("mouseout", function() {cs.innerHTML = "";}, false);
</script>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
#soon:hover:after {
margin-left: 20px;
color: green;
content: "Soon";
}
</style>
</head>
<body>
<p id="soon" style="font-size: 25px; margin-left:5%;"> Site Map </p>
<p style="margin-bottom: 150px;"></p>
<!-- take out the image and it's broken... it shows what I'm trying to do... -->
<img src="lightening-bolt.jpg" alt="Lightening bolt"
height="42" width="42">
<script>
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "inline") {
x.style.display = "none";
} else {
x.style.display = "inline";
}
}
</script>
<p style="display: inline" onmouseover="myFunction()"
onmouseleave="myFunction()">Click Me
</p>
<div id="myDIV">
<span><img src="lightening-bolt.jpg" alt="Lightening bolt"
height="42" width="42"> Text <img src="399-3991460_face-with-stuck-out-tongue-
eye.jpg" alt="Lightening bolt"
height="42" width="42"> </span>
</div>
</body>
</html>

How to style facebook iframe with css?

I have a popup which contains the facebook iframe and its seems like the inline stylesheet method in not work
<div data-html="allow" >
<iframe style="border: 0px; display: block" height="400" class="spoooky-auth" src="https://api.spooo.ky/auth/facebook" border="0"></iframe>
</div>
I am trying to increase the width and height of the iframe but its not work.any clue?
Any help is appreciated.
thanks,
I'd use JS for this, like so:
<div data-html="allow" >
<iframe id="iframe1" style="border: 0px; display: block" height="400" class="spoooky-auth" src="https://api.spooo.ky/auth/facebook" border="0"></iframe>
</div>
<script type="application/javascript">
function resizeIframe {
iframe.width = iframe.contentWindow.document.body.scrollWidth;
iframe.height = iframe.contentWindow.document.body.scrollHeight;
}
window.addEventListener('DOMContentLoaded', function(e) {
var iframe = document.getElementById( 'iframe1' );
resizeIframe;
} );
</script>

Click button show iframe

I need help with using an iframe. I want to make it so that if someone clicks on a button then they see my widget <iframe src="domain.com" style="border: 0; width: 100%; height: 250px;"></iframe>
Now I use
<form name="form_reg_full" id="form_reg_full" class="clearfix" method="post" action="domain.com">
But it only redirects to domain.com and it doesn't show my widget
If i understood correctly what you've said this code would be ok for you:
Javascrpit
function show_frame(state)
{
document.getElementById("myiframe").style.display = state;
}
Html
<input type="button" onclick="show_frame('block');" value=" show frame" />
<iframe id="myiframe" style="border: 0; width: 100%;
height:250px;display:none; width: 1020px; height: 320px" src="domain.com">
</iframe>

Html5 Full screen video

Is there any way to do this? I wan to play video in full screen. Without browser. setting width:100%; height:100%; keep browser visible yet
No, there is no way to do this yet. I wish they add a future like this in browsers.
EDIT:
Now there is a Full Screen API for the web You can requestFullscreen on an Video or Canvas element to ask user to give you permisions and make it full screen.
Let's consider this element:
<video controls id="myvideo">
<source src="somevideo.webm"></source>
<source src="somevideo.mp4"></source>
</video>
We can put that video into fullscreen mode with script like this:
var elem = document.getElementById("myvideo");
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
Full documentation
From CSS
video {
position: fixed; right: 0; bottom: 0;
min-width: 100%; min-height: 100%;
width: auto; height: auto; z-index: -100;
background: url(polina.jpg) no-repeat;
background-size: cover;
}
All hail HTML5 _/\_
var videoElement = document.getElementById('videoId');
videoElement.webkitRequestFullScreen();
Here is a very simple way (3 lines of code) using the Fullscreen API and RequestFullscreen method that I used, which is compatible across all popular browsers:
var elem = document.getElementsByTagName('video')[0];
var fullscreen = elem.webkitRequestFullscreen || elem.mozRequestFullScreen || elem.msRequestFullscreen;
fullscreen.call(elem); // bind the 'this' from the video object and instantiate the correct fullscreen method.
For browser compatibility:
MDN & Can I use
You can do it with jQuery.
I have my video and controls in their own <div> like this:
<div id="videoPlayer" style="width:520px; -webkit-border-radius:10px; height:420px; background-color:white; position:relative; float:left; left:25px; top:55px;" align="center">
<video controls width="500" height="400" style="background-color:black; margin-top:10px; -webkit-border-radius:10px;">
<source src="videos/gin.mp4" type="video/mp4" />
</video>
<script>
video.removeAttribute('controls');
</script>
<div id="vidControls" style="position:relative; width:100%; height:50px; background-color:white; -webkit-border-bottom-left-radius:10px; -webkit-border-bottom-right-radius:10px; padding-top:10px; padding-bottom:10px;">
<table width="100%" height="100%" border="0">
<tr>
<td width="100%" align="center" valign="middle" colspan="4"><input class="vidPos" type="range" value="0" step="0.1" style="width:500px;" /></td>
</tr>
<tr>
<td width="100%" align="center" valign="middle">Play</td>
<td width="100%" align="center" valign="middle">Vol</td>
<td width="100%" align="left" valign="middle"><p class="timer"><strong>0:00</strong> / 0:00</p></td>
<td width="100%" align="center" valign="middle">Full</td>
</tr>
</table>
</div>
</div>
And then my jQuery for the .fullscreen class is:
var fullscreen = 0;
$(".fullscreen").click(function(){
if(fullscreen == 0){
fullscreen = 1;
$("video").appendTo('body');
$("#vidControls").appendTo('body');
$("video").css('position', 'absolute').css('width', '100%').css('height', '90%').css('margin', 0).css('margin-top', '5%').css('top', '0').css('left', '0').css('float', 'left').css('z-index', 600);
$("#vidControls").css('position', 'absolute').css('bottom', '5%').css('width', '90%').css('backgroundColor', 'rgba(150, 150, 150, 0.5)').css('float', 'none').css('left', '5%').css('z-index', 700).css('-webkit-border-radius', '10px');
}
else
{
fullscreen = 0;
$("video").appendTo('#videoPlayer');
$("#vidControls").appendTo('#videoPlayer');
//change <video> css back to normal
//change "#vidControls" css back to normal
}
});
It needs a little cleaning up as I'm still working on it but that should work for most browsers as far as I can see.
Hope it helps!
You can use html5 video player which has full screen playback option.
This is a very good html5 player to have a look.
http://sublimevideo.net/
if (vi_video[0].exitFullScreen) vi_video[0].exitFullScreen();
else if (vi_video[0].webkitExitFullScreen) vi_video[0].webkitExitFullScreen();
else if (vi_video[0].mozExitFullScreen) vi_video[0].mozExitFullScreen();
else if (vi_video[0].oExitFullScreen) vi_video[0].oExitFullScreen();
else if (vi_video[0].msExitFullScreen) vi_video[0].msExitFullScreen();
else { vi_video.parent().append(vi_video.remove()); }
Add object-fit: cover to the style of video
<video controls style="object-fit: cover;" >