Just a quick question for people who have any experience with this. I'm getting an infographic designed for my blog and noticed that other people have a function to make the infographic go to a full width template at the click of a button.
Here's an example:
https://blog.kissmetrics.com/science-of-brands-on-instagram/
If you click on the infographic, rather than going directly to the image page, it loads the header and changes the template to a full width. I noticed that the URL query goes to ?wide=1.
Is this a plugin or a built in function in Wordpress? Any help would be greatly appreciated :-)
It's hard to say if it's a plugin or the template just naturally displays clicked images like that, but I think I might consider doing a javascript instead. That way you don't move off the page when enlarging and image. Something like this:
Demo: http://jsfiddle.net/8w0ay8xs/
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<style>
.mycol {
width: 500px;
border: 1px solid #000;
}
.myimg {
width: 500px;
}
.allwide {
position: absolute;
text-align: center;
margin: 30px auto;
left: 10px;
right: 10px;
display: inline-block;
width: 90%;
float:left;
box-shadow: 0px 0px 30px rgba(0,0,0,0.4);
border: 10px solid #FFF;
min-width: 700px;
}
</style>
<div class="mycol">
<h1>Infographic: The Science of Brands on Instagram</h1>
<p>No other social platform provides an experience as incredibly focused and engaging as Instagram. With just a bit of creativity and thoughtful measuring, you can make some Insta-magic for your brand. In this infographic, discover the trends behind the big-brand Instagram experience and learn how you can catapult your company to new heights.</p>
<p>Click on the infographic below to view a larger image:</p>
<img src="http://www.jpeg.org/images/jpeg-home.jpg" class="myimg" />
</div>
<script>
jQuery(document).ready(function() {
jQuery(".myimg").click(function() {
jQuery(this).toggleClass("allwide");
});
});
</script>
Related
I have an iframe fullscreen, how can I make a div that is on that iframe?
I'm trying to do something like the Netflix player, just more static WITHOUT javascript
so there is the iframe,
then there is a div with some buttons and functions in php but the div has a background cutted, on top of the iframe.
Is it doable?
LIKE THIS IMAGE CHECK PLS
Here is a possible solution :
<div class="iframe_container">
<iframe width="100%" height="700px"></iframe>
<div class="custom_functions"></div>
</div>
<style type="text/css">
div.iframe_container {position: relative; width: 100%; height: 700px; background-color: #F0F;}
div.custom_functions {position: absolute; bottom: 20px; left: 20px; right: 20px; z-index: 1; background-color: #FF0; height: 200px;}
</style>
update the values as needed and make it fit your needs
I'm no .php expert, so I'm looking for a little help (or at least an explanation)
A plugin I'm using on my organization's site (called Coin Slider 4 WordPress) is slowing the site to a crawl. I ran a full page test on pingdom tools and the plugin's .php file (coin-slider-4-wp.css.php) takes more than 11 seconds to load. The .php file itself is only 1kb, and nothing else is particularly slow.
Here's a screen shot:
And here's the text of the .php file in question:
/* Coin Slider jQuery plugin CSS styles
http://workshop.rs/projects/coin-slider
*/
.coin-slider { overflow: hidden; zoom: 1; position: relative; }
.coin-slider a{ text-decoration: none; outline: none; border: none; }
.cs-buttons { font-size: 0px; padding: 10px; float: left; }
.cs-buttons a { margin-left: 5px; height: 10px; width: 10px; float: left; border: 1px solid #B8C4CF; color: #B8C4CF; text-indent: -1000px; }
.cs-active { background-color: #B8C4CF; color: #FFFFFF; }
.cs-title { width: 920px; padding: 10px; background-color: #000000; color: #FFFFFF; }
.cs-prev, .cs-next { background-color: #000000; color: #FFFFFF; padding: 0px 10px; }
#coin-slider-coin-slider { width: 940px}
Not really sure what's going on, but any tips/advice would be great, as this is obviously making our site unusable :/
Thanks!
The coin slider 4 WP plugin hasn't been updated in 2 years. I'd recommend adopting something more stable and actively maintained such as Nivo Slider
UPDATE: You could also tell the plugin not to call that php file.
Open the Editor in WP in your Plugins sidebar. On the right you will see a drop down with the different plugins you can edit. Slect the coinslider plugin. Now below that dropdown, you will see a list of files. In your coinslider-content.php file, there is a link to your CSS file.
Remove this line:
<link rel=\"stylesheet\" href=\"".$path."css/coin-slider-4-wp.css.php\" type=\"text/css\" media=\"screen\" charset=\"utf-8\"/>
From:
function cs_head(){
$path = get_bloginfo('wpurl')."/wp-content/plugins/coin-slider-4-wp/";
$script = "
<link rel=\"stylesheet\" href=\"".$path."css/coin-slider-4-wp.css.php\" type=\"text/css\" media=\"screen\" charset=\"utf-8\"/>
<script type=\"text/javascript\" src=\"".$path."scripts/jquery-1.4.2.min.js\"></script>
<script type=\"text/javascript\" src=\"".$path."scripts/coin-slider.min.js\"></script>
";
echo $script;
}
Once you have removed that line, copy the content from your coin-slider-4-wp.css.php file. Click Editor on you Theme sidebar on the left. On the right you will see a list of files, one of them being style.css. Paste the contents of your coin-slider-wp.css.php at the bottom of your style.css (stylesheet) file.
Once you have done all this. It should remove that 11s it takes to request the file. Try it out and let me know if it works.
What i have:
I have a player status script for our Minecraft Server which displays the name of the server the ip and the heads of the current players. 2 Div boxes for the statusbox: An outer 1 to fix the position and the 2nd one for the divbox itself.
What i want:
I want the current divbox where the iframes are in:
<div class="statusbox">
<div class="statusboxinner">
<iframe src="players_main.php" height="auto" width="140px" frameborder="0" scrolling="no" padding="fixed" marginheight="auto"></iframe> <iframe src="players_hg.php" height="auto" width="140px" frameborder="0" scrolling="no" marginheight="auto"></iframe>
</div>
</div>
To be 100% fixed to the php file which is loaded by the iframes.
CSS codes:
.statusbox {
position: fixed;
background: none;
margin-top: 472px;
margin-left: 1000px;
#pointer-events:none;
z-index:0;
}
.statusboxinner {
float: right;
margin-right: -243px;
#pointer-events:auto;
position: relative;
padding: auto;
height:auto;
padding-top:auto;
margin-bottom:auto;
background-color: white;
border-radius: 3px;
text-shadow: 0px 1px 0px black;
box-shadow: inset -4px 0px 5px rgba(0,0,0,0.2);
}
You can look at it on this page www.ravand.org (right floating box)
What my problem is:
I could simply add a fixed amount of pixels to be the height of the divbox but the problem is, that according to how many people are playing on the server the php file/ the iframe enlarges to the bottom.
When i try to set "height:100%" the statusbox simply just gets enlarged all the way to the buttom which is not what i need.
I would gladly solve this problem without iframes if you have any suggestions.
Thanks in advance
ravand
found a cool script I think should do the trick here.
<script type="text/javascript">
<!--//
function sizeFrame() {
var F = document.getElementById("myFrame");
if(F.contentDocument) {
F.height = F.contentDocument.documentElement.scrollHeight+30; //FF 3.0.11, Opera 9.63, and Chrome
} else {
F.height = F.contentWindow.document.body.scrollHeight+30; //IE6, IE7 and Chrome
}
}
window.onload=sizeFrame;
//-->
</script>
The image below explains what I am trying to achieve.
I need to show a user's car picture with the name under it. Each image/name pair should be in a DIV so as a user adds more cars, they move to the next line or page. Ideally the DIVs should be centered, more as a matter of aesthetics.
Using DOMPDF, I am generating a PDF from an HTML layout.
Unfortunately, DOMPDF's support for float is bad, even in the new 0.6.2 beta. I wonder if this layout I am proposing could be done without float. DOMPDF also does not support unordered lists.
I have tried some solutions using tables, but this also isn't good since DOMPDF does not allow cells to spill over to the next page.
I am using PHP 5/ codeigniter, and DOMPDF 0.5.2 (stable).
Any suggestions on how to get this layout are greatly appreciated!
Here is the code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
img {width: 150px; height: 150px;}
h1 {font-size: 3em; text-align: center;}
h2 {text-transform: uppercase; width: 150px; text-align: center;}
div {margin: 10px; width: 150px;}
</style>
</head>
<h1>My Cars</h1>
<?php foreach ($cars as $row): ?>
<div>
<img src="<?php echo $row->cars_picture; ?>" />
<h2><?php echo $row->cars_name; ?></h2>
</div>
<?php endforeach; ?>
</html>
Thanks to #rkw and #manyxcxi for helping out.
At the end the only way of doing this without hacks was to use mpdf instead of DOMPDF.
I have the impression mpdf is a much better library, with better documentation. It has partial support for float, but it works very nicely and does exactly what I needed above.
If the boxes are all fixed width and you know the width of your PDF, then you can calculate the boxes per row and use a spacer div on the left of the bottom row to give you the offset you're looking for.
Without using float, you would have to use instead of : http://jsfiddle.net/AxZam/40/
relevant css:
body {
width:800px;
}
#content {
margin: 0px auto;
width: 600px;
text-align: center;
}
img {
width: 150px;
height: 150px;
}
h1 {
font-size: 3em;
}
.cars {
text-transform: uppercase;
width:150px;
display:block;
position:absolute;
top:0px; left:0px; }
span {
margin: 10px;
position: relative;
}
relevant html section:
<div id='content'>
<h1>My Cars</h1>
<span>
<img />
<span class='cars'>car</span>
</span>
...
</div>
I have a "news" div and a "banner" div.
I want user to see the "banner" div when page loads. This "banner" div should show over the "news" div, exactly over the position, covering the "news" div. So:
How should I do to detect position of "news" div and show the "banner" div over, floating, without affecting the grid structure?
Any jQuery plugin that allows user to hide that div and never show again? w/ cookie?
Hope you've understood my idea. I leave an image:
use the jquery's offset
http://api.jquery.com/offset/
and the jquery's show and hide
http://api.jquery.com/show/
you can use hte negative margin for the banner to come over to the news...div.
Let me know if you need anything...
use absolute postioning for news banner.
I've written a script for you which should help.
It uses the Cookie plugin for jQuery.
I've put some comments in the code so hopefully it should be pretty self-explanatory.
Feel free to come back with other questions you may have.
Usage
You should see a banner on first load, then click run again and it should dissapear.
The banner will be positioned exactly above the news-list using absolute positioning, the width/height and the top/left offset of the newslist.
I realise this question has already been answered, but I thought I'd offer a slight alternative, using CSS, jQuery and the jQuery cookie plugin:
html:
<div class="container">
<div class="news">
<p>Lorem ipsum dolor sit amet...</p>
</div>
<div class="banner">
<p>Yet more text, this time it's the banner.</p>
<span class="close">X</span>
</div>
</div>
<div id="clear">Remove the cookie</div>
css:
.container {
width: 80%;
min-height: 400px;
position: relative;
border: 4px solid #000;
}
.news {
width: 100%;
height: 100%;
}
.banner {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #f00;
}
.close {
position: absolute;
top: 0;
right: 0;
border-left: 2px solid #fff;
border-bottom: 2px solid #fff;
width: 2em;
line-height: 2em;
text-align: center;
display: block;
cursor: pointer;
}
#clear {
width: 80%;
text-align: right;
color: #fff;
background-color: #999;
border: 4px solid #000;
border-top-width: 0;
font-family: arial, sans-serif;
cursor: pointer;
}
jQuery:
$(document).ready(
function(){
if ($.cookie('closed')){
$('.banner').remove();
}
$('.close').click(
function(){
$(this).closest('.banner').remove();
$.cookie('closed',true, {expires: 30});
});
$('#clear').click(
function(){
$.cookie('closed',false, {expires: -200});
});
});
JS Fiddle demo.
A slightly more pleasing demo, with animate():
$(document).ready(
function(){
if ($.cookie('closed')){
$('.banner').remove();
}
$('.close').click(
function(){
$(this)
.closest('.banner')
.animate(
{
'top':'120%'
}, 1500,
function(){
$(this).remove();
}
);
$.cookie('closed',true, {expires: 30});
});
$('#clear').click(
function(){
$.cookie('closed',false, {expires: -200});
});
});
Demo at JS Fiddle
Edited with an afterthought, assuming that you get repeat visitors, it might be worth re-setting the cookie in the initial if check, to ensure that they don't see the banner ever again (unless they leave more than 30 days between visits), changing it to:
if ($.cookie('closed')){
$('.banner').remove();
$.cookie('closed',true,{expires: 30});
}