flexslider images how to add title - flexslider

I need to add a title to my image so that flexslider will show that as the caption. However I cannot figure out how to add a title to the image field in drupal 7 . I tried adding fields to the file type image admin/config/media/file-types/manage/image/display
but it doesnt take what I put in in the form .

If you create your own template, copy the original and add print the title-caption like this with either the alt or title field:
<div id="slider" class="flexslider">
<ul class="slides">
<?php foreach ($items as $img):?>
<li><?php print render ($img) ; ?>
<?php if (!empty($img['#item']['alt'])) { ?>
<p class="title-caption"><?php print $img['#item']['alt']; ?></p>
<?php } ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php
$counter = count($items);
if($counter > 0){ ?>
<div id="carousel" class="flexslider">
<ul class="slides">
<?php foreach ($items as $img): ?>
<li><?php print render($img); ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php }
Then add to your css:
.title-caption {
position: absolute;
width: 99%;
padding: 10px;
bottom: 0px;
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,.5);
font-size: 20px;
line-height: 28px;
margin: 5px;
}

Someone has answered this for me here http://drupal.org/node/1067620#comment-6994238
You have to edit the content type, then edit the image and if you scroll down there is a check box for "Enable Title"

Related

Google Script: Editors can't save data from sidebar in the sheet

The HTML sidebar get user input and save it in sheet:
with sheet's owner, it works fine (the data from sidebar are
correctly saved in the sheet)
with others sheet editors the data from sidebar is NOT been saved in the sheet.
Owner and users at same domain
Apps Script Dashboard shows NO error
I would be very grateful for any help on how I can fix this issue.
SIDEBAR SOURCE:
<!DOCTYPE html>
<html>
<!-- Style should be in the head -->
<style>
.info {
margin: 5px;
width: 95%;
padding: 2px;
font-size: 14px;
font-weight: bold;
}
.msg {
margin: 5px;
width: 95%;
padding: 2px;
font-size: 13px;
}
.container,
.buttons {
margin: 5px;
width: 95%;
padding: 2px;
font-size: 13px;
}
</style>
<head>
<base target="_top">
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
</head>
<body>
<div class="msg">
<p align="justify">Marque todos os motivos que levaram ao indeferimento do requerimento</p>
</div>
<div class="info">
<p id="stdname"></p>
<p id="stamp"></p>
<p id="applied"></p>
<p id="eRange"></p>
</div>
<div class="container">
<?!=rngValid?>
</div>
<div class="buttons">
<p>
<button class="action" id="action" onclick="saveReasons();">Salvar motivos</button>
</p>
<br>
</div>
<!-- These should be in the head. They should be there prior to page loading-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/mdehoog/Semantic-UI/6e6d051d47b598ebab05857545f242caf2b4b48c/dist/semantic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.js"></script>
<script>
var stamp = <?= stamp ?>;
var to = <?= to ?>;
var subject = <?= subject ?>;
var stdName = <?= stdName ?>;
var apply = <?= apply ?>;
var eRange = <?= eRange ?>;
document.getElementById("stdname").innerHTML = stdName;
document.getElementById("stamp").innerHTML = stamp;
document.getElementById("applied").innerHTML = apply;
document.getElementById("eRange").innerHTML = eRange;
function saveReasons() {
var selected = [];
//get all checkboxes
var checkboxes = document.getElementsByClassName("ui.checkbox");
console.log("checkboxes length: "+ checkboxes.length);
console.log("checkboxes: "+ checkboxes);
$("input:checkbox[name=sel]:checked").each(function() {
selected.push($(this).val());
$(this).prop( "checked", false );
})
console.log("selected: "+ selected);
console.log("eRange: "+ eRange);
google.script.run
.withFailureHandler(() => {console.log("Error running script")})
.process(selected,stdName, apply, eRange);
}
</script>
</body>
</html>
DEV TOOLS CONSOLE:
Net state changed from IDLE to BUSY 386795301-warden_bin_i18n_warden.js:67
Net state changed from BUSY to IDLE userCodeAppPanel:36
Error running script
On your client-side code there is the following
google.script.run
.withFailureHandler(() => {console.log("Error running script")})
.process(selected,stdName, apply, eRange);
The problem with the above code is that it give very low help to debug the main problem.
To get a meaningful error message replace
.withFailureHandler(() => {console.log("Error running script")})
to
.withFailureHandler((error) => {console.log('%s, %s',error.message, error.stack)})

Jssor slider loading time

I have added multiple instances of "jssor slider" for product carousel in a single page, its working fine but when I refresh the page it takes a lot of time to load the carousel on homepage how can I reduce the loading time of carousel?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Carousel Demo - Jssor Slider, Carousel, Slideshow with Javascript Source Code</title>
</head>
<body style="font-family:Arial, Verdana;background-color:#fff;">
<!-- it works the same with all jquery version from 1.x to 2.x -->
<script type="text/javascript" src="examples/js/jquery-1.9.1.min.js"></script>
<!-- use jssor.slider.mini.js (40KB) instead for release -->
<!-- jssor.slider.mini.js = (jssor.js + jssor.slider.js) -->
<script type="text/javascript" src="examples/js/jssor.js"></script>
<script type="text/javascript" src="examples/js/jssor.slider.js"></script>
<script>
jQuery(document).ready(function ($) {
var options = {
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$AutoPlaySteps: 1, //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
$AutoPlayInterval: 4000, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
$PauseOnHover: 1, //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1
$ArrowKeyNavigation: true, //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
$SlideDuration: 160, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
$MinDragOffsetToSlide: 20, //[Optional] Minimum drag offset to trigger slide , default value is 20
$SlideWidth: 200, //[Optional] Width of every slide in pixels, default value is width of 'slides' container
//$SlideHeight: 150, //[Optional] Height of every slide in pixels, default value is height of 'slides' container
$SlideSpacing: 3, //[Optional] Space between each slide in pixels, default value is 0
$DisplayPieces: 4, //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default value is 1
$ParkingPosition: 0, //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
$UISearchMode: 1, //[Optional] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
$PlayOrientation: 1, //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
$DragOrientation: 1, //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
$BulletNavigatorOptions: { //[Optional] Options to specify and enable navigator or not
$Class: $JssorBulletNavigator$, //[Required] Class to create navigator instance
$ChanceToShow: 2, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 0, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 1, //[Optional] Steps to go for each navigation request, default value is 1
$Lanes: 1, //[Optional] Specify lanes to arrange items, default value is 1
$SpacingX: 0, //[Optional] Horizontal space between each item in pixel, default value is 0
$SpacingY: 0, //[Optional] Vertical space between each item in pixel, default value is 0
$Orientation: 1 //[Optional] The orientation of the navigator, 1 horizontal, 2 vertical, default value is 1
},
$ArrowNavigatorOptions: {
$Class: $JssorArrowNavigator$, //[Requried] Class to create arrow navigator instance
$ChanceToShow: 1, //[Required] 0 Never, 1 Mouse Over, 2 Always
$AutoCenter: 2, //[Optional] Auto center navigator in parent container, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default value is 0
$Steps: 1 //[Optional] Steps to go for each navigation request, default value is 1
}
};
var jssor_slider1 = new $JssorSlider$('slider1_container', options);
//responsive code begin
//you can remove responsive code if you don't want the slider scales while window resizes
function ScaleSlider() {
var bodyWidth = document.body.clientWidth;
if (bodyWidth)
jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 809));
else
window.setTimeout(ScaleSlider, 30);
}
ScaleSlider();
$(window).bind("load", ScaleSlider);
$(window).bind("resize", ScaleSlider);
$(window).bind("orientationchange", ScaleSlider);
//responsive code end
});
</script>
<!-- Jssor Slider Begin -->
<!-- To move inline styles to css file/block, please specify a class name for each element. -->
<div id='slider1_container' style="position: relative; top: 0px; left: 0px; width: 100%; height: 350px; overflow: hidden;">
<!-- Loading Screen -->
<div u="loading" style="position: absolute; top: 0px; left: 0px;">
<div style="filter: alpha(opacity=70); opacity:0.7; position: relative; display: block;
background-color: #000; top: 0px; left: 0px;width: 100%;height:100%;">
</div>
<div style="position: absolute; display: block; background: url(examples/img/loading.gif) no-repeat center center;
top: 0px; left: 0px;width: 100%;height:100%;">
</div>
</div>
<!-- Slides Container -->
<div u="slides" style="cursor: move; position: absolute; left: 100px; top: 0px; width: 100%; height: 350px; overflow: hidden;">
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
<?php $_products = $this->getProductCollection(); ?>
<?php $_collectionSize = sizeof($_products); ?>
<?php $_columnCount = Mage::getStoreConfig('homepage/options/count'); ?>
<div class="block-content" >
<?php if (sizeof($_products)): ?>
<?php if ($i++%$_columnCount==10): ?>
<ul class="products-grid">
<?php endif ?>
<?php // echo $_product->getData('is_salable') . Mage::getStoreConfig('homepage/options/salable'); ?>
<?php if ($_product->getData('is_salable')): ?>
<li class="item<?php if($i==sizeof($_products) ): ?> last<?php endif; ?>">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(1930); ?>" width="100%" height="140" alt="" />
<div class="product-details">
<p class="product-name"><?php echo $this->htmlEscape($_product->getName()) ?></p>
<?php if (Mage::getStoreConfig('homepage/options/price')):?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php endif; ?>
<?php if (Mage::getStoreConfig('homepage/options/actions')):?>
<a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart') ?></a>
<?php endif; ?>
</div>
</li>
<?php else: ?>
<?php if( Mage::getStoreConfig('homepage/options/salable')) : ?>
<li class="item">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(1930); ?>" width="130" height="130" alt="" />
<div class="product-details">
<p class="product-name"><?php echo $this->htmlEscape($_product->getName()) ?></p>
<?php if (Mage::getStoreConfig('homepage/options/price')):?>
<?php echo $this->getPriceHtml($_product, true) ?>
<?php endif; ?>
<?php if (Mage::getStoreConfig('homepage/options/actions')):?>
<a class="link-cart" href="<?php echo $this->getAddToCartUrl($_product) ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->__('Add to Cart ') ?></a>
<?php endif; ?>
</div>
</li>
<?php endif; ?>
<?php endif; ?>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
<?php endif ?>
<?php else: ?>
<ol id="bestseller-sidebar" class="mini-products-list">
<li class="item odd">
<?php echo Mage::getStoreConfig('homepage/options/noproduct') ?>
</li>
</ol>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<!--#region Bullet Navigator Skin Begin -->
<!-- Help: http://www.jssor.com/development/slider-with-bullet-navigator-jquery.html -->
<style>
/* jssor slider bullet navigator skin 03 css */
/*
.jssorb03 div (normal)
.jssorb03 div:hover (normal mouseover)
.jssorb03 .av (active)
.jssorb03 .av:hover (active mouseover)
.jssorb03 .dn (mousedown)
*/
.jssorb03 {
position: absolute;
}
.jssorb03 div, .jssorb03 div:hover, .jssorb03 .av {
position: absolute;
/* size of bullet elment */
width: 21px;
height: 21px;
text-align: center;
line-height: 21px;
color: white;
font-size: 12px;
background: url(examples/img/b03.png) no-repeat;
overflow: hidden;
cursor: pointer;
}
.jssorb03 div { background-position: -5px -4px; }
.jssorb03 div:hover, .jssorb03 .av:hover { background-position: -35px -4px; }
.jssorb03 .av { background-position: -65px -4px; }
.jssorb03 .dn, .jssorb03 .dn:hover { background-position: -95px -4px; }
</style>
<!-- bullet navigator container -->
<!--#endregion Bullet Navigator Skin End -->
<!--#region Arrow Navigator Skin Begin -->
<!-- Help: http://www.jssor.com/development/slider-with-arrow-navigator-jquery.html -->
<style>
/* jssor slider arrow navigator skin 03 css */
/*
.jssora03l (normal)
.jssora03r (normal)
.jssora03l:hover (normal mouseover)
.jssora03r:hover (normal mouseover)
.jssora03l.jssora03ldn (mousedown)
.jssora03r.jssora03rdn (mousedown)
*/
.jssora03l, .jssora03r {
display: block;
position: absolute;
/* size of arrow element */
width: 55px;
height: 55px;
cursor: pointer;
background: url(examples/img/a03.png) no-repeat;
overflow: hidden;
}
.jssora03l { background-position: -3px -33px; }
.jssora03r { background-position: -63px -33px; }
.jssora03l:hover { background-position: -123px -33px; }
.jssora03r:hover { background-position: -183px -33px; }
.jssora03l.jssora03ldn { background-position: -243px -33px; }
.jssora03r.jssora03rdn { background-position: -303px -33px; }
</style>
<!-- Arrow Left -->
<span u="arrowleft" class="jssora03l" style="top: 123px; left: 8px;">
</span>
<!-- Arrow Right -->
<span u="arrowright" class="jssora03r" style="top: 123px; right: 8px;">
</span>
<!--#endregion Arrow Navigator Skin End -->
<a style="display: none" href="http://www.jssor.com">Bootstrap Slider</a>
</div>
<!-- Jssor Slider End -->
</body>
</html>

Position: Sticky example in JS Fiddle

I am testing the new position:sticky feature but it does not appear to work.
CSS
.slide {
width:300px;
height:400px;
border:1px solid #888;
border-radius:8px;
position:relative;
overflow:auto;
}
.slide > ul {
padding:0;
margin:0;
position:relative;
}
.slide > ul > li {
min-height:20px;
display:block;
padding:10px;
background:#F8F8F8;
box-shadow:inset 0 0 3px #CCC;
list-style:none;
}
.slide > ul > li.title {
min-height:12px;
background:#888;
colour:#FFF;
font-weight:bold;
position:-webkit-sticky;
}
HTML
<div class="slide">
<ul>
<li class="title">Settings</li>
<li>General</li>
<li>Social</li>
<li>Search Engine</li>
</ul>
<ul>
<li class="title">Privacy</li>
<li>Personal</li>
<li>Business</li>
<li>Enigma</li>
</ul>
<ul>
<li class="title">Settings</li>
<li>General</li>
<li>Social</li>
<li>Search Engine</li>
</ul>
<ul>
<li class="title">Privacy</li>
<li>Personal</li>
<li>Business</li>
<li>Enigma</li>
</ul>
</div>
The Fiddle http://jsfiddle.net/78kxU/3/
position: sticky requires you to specify either a top or bottom CSS property in order to determine where/when the sticky element should begin sticking. You should also specify the un-vendor-prefixed value for forwards-compatibility (in this case, it seems to be required, at least on Chrome 30.0.1599.101).
So, in other words, add these two lines to your .slide > ul > li.title style rules:
position: sticky;
top: 0;
Here's the updated fiddle: http://jsfiddle.net/46gpu/

TCPDF shows empty page

i am using tcpdf.php to create a pdf.here is my simple html,when i print html,it is ok but when i write pdf it shows nothing.
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$html='
<div style="background:#2185E7;color:#fff;padding:5px;overflow:hidden;width:786px;">
<h3 style="margin-bottom: 0; margin-top: 0;padding-left: 17px;text-align: left; white-space: nowrap;float:left;">My Company name: 2533</h3>
<p style="margin: 0; padding-right: 14px;text-align: right; white-space: nowrap;float:right;">321 32111 4</p>
</div>
<div style="background:#2185E7;color:#fff;padding:5px;overflow:hidden;width:786px; margin:10px 0 0 0;">
<p style="margin: 0;">Elegant 3 B/R + Maids in , Dubai </p>
</div>
';
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->Output('example_006.pdf', 'I');
You need to remove css attr color:#fff in the first div. I don't know why but it's OK when remove out.
P/S:TCPDF don't understand attribute margin and padding. My solution is always use html tag table for layout all general PDF. You should try it.

How to prevent absolute position <ul> inside <li> to change its width?

I'm trying to achieve this effect.
Say we have this structure:
<ul id="menu">
<li>Guides
<ul>
<li>Getting Started</li>
<li>Characters</li>
<li>Epics</li>
<li>Road Map</li>
</ul>
</li>
<li>Skills</li>
<li>Equipments</li>
</ul>
and this simplified CSS:
ul#menu {
display:inline-block;
list-style-type:none;
padding:0;
height:30px; /* So the ul#menu's height isn't changed by the ul#menu>li>ul */
overflow:visible; /* So the ul#menu>li>ul is visible on ul#menu>li:hover */
background: #e69646;
box-shadow:0 2px 3px 0 #666;
}
ul#menu>li>ul {
list-style-type:none;
padding:0;
position:absolute;
background:inherit; /* */
box-shadow:inherit;
}
The problem is that having ul#menu>li>ul on absolute positioning makes it lose it's background gradient and shadow. background:inherit and box-shadow:inherit yield this result.
Is there a way to achieve the desired result?
Thank you in advance guys :)
This is the way I would do it - http://jsfiddle.net/bh6L5/3/
<ul id="menu">
<li>Guides
<ul>
<li>Getting Started</li>
<li>Characters</li>
<li>Epics</li>
<li>Road Map</li>
<div id="fake">Guides</div>
</ul>
</li>
<li>Skills</li>
<li>Equipments</li>
</ul>
Then add this to your css
#fake {
position:absolute;
width:45px;
height:31px;
padding:0 10px;
background: #e69646;
z-index:999;
top: -31px;
left:0px;
border-top-left-radius:5px;
border-top-right-radius:5px;
-webkit-border-radius-topleft:5px;
-webkit-border-radius-topright:5px;
-moz-border-radius-topleft:5px;
-moz-border-radius-topright:5px;
}