Creating image tabs with Jquery UI - css

I want to use custom images as tabs to show and hide divs like this: http://jqueryui.com/tabs/
I also alternate images for the tab that is active but don't know how to implement them properly.
This guy was close but the code is messy and doesn't quite work: http://jsfiddle.net/5FVb7/1/
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
This is all of the scripting that the jQuery UI site seems to suggest is needed?
This is my html:
<div id="tabs">
<ul>
<li><img src="img/bt1.png" /></li>
<li><img src="img/bt4.png" /></li>
<li><img src="img/bt2.png" /></li>
<li><img src="img/bt3.png" /></li>
</ul>
<div id="tab1"><p> Words go here innit </p></div>
<div id="tab4"><p> Testa texta </p></div>
<div id="tab2"><p> eeyyeeeeee </p></div>
<div id="tab3"><p> Cheap as chips </p></div>
</div>
My CSS so far is just for positioning and some style - no functionality is present.

I think I'm probably missing something.
Moved your html to FIDDLE, added some net images, and everything works OK.
If you want specific images, you'll have to photoshop them, resize them to fit.
Is this what you're looking for?
HTML for one of the resized images
<li><a href="#tab2"><img height='42' width='42'
src="http://www.twitip.com/wp-content/uploads/2008
/11/twitter-button-small.png" /></a></li>

Related

Lazy loading in Light Gallery

I'm using lightgallery.js (https://sachinchoolur.github.io/lightgallery.js) to develop my ASP.NET MVC project.
It seems ok to load some images which have a size of less than 1MB, but the problem here when I use about ~20 pictures (~2MB/picture), Light Gallery will load very slow.
Could you share with me some ideas to overcome this problem?
Thanks for reading.
Hi please check this example lazy load image.
For more detail please check the official link -> Click me
$(document).ready(function(){
$("ul.jsImageUl > li img").lazy({
effect: "fadeIn",
effectTime: 1000
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.lazy/1.7.3/jquery.lazy.min.js"></script>
<ul class="jsImageUl">
<li>
<img data-src="https://farm4.static.flickr.com/3089/2796719087_c3ee89a730_t.jpg" width="200" height="200" alt="" />
</li>
<li>
<img data-src="https://farm1.static.flickr.com/143/321464099_a7cfcb95cf_t.jpg" width="200" height="200" alt="" />
</li>
<li>
<img data-src="https://farm1.static.flickr.com/79/244441862_08ec9b6b49_t.jpg" width="200" height="200" alt="" />
</li>
</ul>

Materialize - Like that triggers sidenav disappears

I am trying to get a sidemenu to work on Materialize when should be very simple:
First I add the sidenav content to the page:
<ul id="slide-out" class="sidenav">
<li><div class="user-view">
<div class="background">
<img src="images/office.jpg">
</div>
<img class="circle" src="images/yuna.jpg">
<span class="white-text name">John Doe</span>
<span class="white-text email">jdandturk#gmail.com</span>
</div></li>
<li><i class="material-icons">cloud</i>First Link With Icon</li>
<li>Second Link</li>
<li><div class="divider"></div></li>
<li><a class="subheader">Subheader</a></li>
<li><a class="waves-effect" href="#!">Third Link With Waves</a></li>
</ul>
Then I add the jquery code:
$( document ).ready(function() {
$('.sidenav').sidenav();
});
And finally the part where to problem is:
I have a nav which goes at the top of the page:
<nav>
<div class="nav-wrapper">
<img src="icon.png" alt="" />
<ul class="left hide-on-med-and-down" style="position: relative; left: 100px;">
<li>Trigger SideNav</li><!-- This is just not showing -->
</ul>
</div>
</nav>
For some reason this menu is not showing:
<li>Trigger SideNav</li>
unless I take this off it ... data-target="slide-out" class="sidenav-trigger"
How can I fix this?
In addition to what Moein said (the sidenav-trigger menu only appears when the page width is less than 993px), you can make it appear all the same adding the show-on-large class to your menu button.
Something like:
<nav>
<div class="nav-wrapper">
<i class="material-icons">menu</i>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li>Menu</li>
<li>Info</li>
</ul>
</div>
</nav>
as I know this is not a problem and the element that has sidenav-trigger class will be shown when the width of the browser is less than 993px. just resize your browser window width to reach less than 993px and see the result.
If it does not work:
I think the problem can be with the content of your link. replace the image with a text and try again.
For reputation reasons, I'm not allowed to comment. It'll work with the javascript code
document.addEventListener('DOMContentLoaded', function(){
var elems = document.querySelectorAll('.sidenav');
var instances = M.Sidenav.init(elems, {});
});
Instead of the code which is given in the official documentation you've to change this piece of code
M.Sidenav.init(elems, options);
with this
M.Sidenav.init(elems, {});
With the official javascript code you'll notice that there's an error in the console when you load the page.

popover on hover in wordpress

I want popover on hover of product images in WordPress, i used popover.js also include js and css of bootstrap. my WordPress theme has included bootstrap.
here is my product image code,
<img class="alignnone size-full wp-image-134" src="Projektorer-research.jpg" alt="Projektorer-research" width="268" height="150" />
here i used data-content="test" for example, actually i want to display unordered list over there.
Are you initializing your Popovers? You must initialize them yourself with JS like in the example Snippet.
See docs working example.
$(function() {
$('[data-toggle="popover"]').popover();
});
body,
html {
margin: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<a href="#" data-toggle="popover" data-trigger="hover" data-content="test">
<img class="alignnone size-full wp-image-134" src="http://placehold.it/350x150" alt="..." width="268" height="150" />
</a>
i think you are trying to display custom(html) content in your popover, if you do like below you can set any content in your popover.
<div id="popover_content" class="row company-logo" style="display: none">
<ul>
<li><img src="images/alico-logo.png" alt=""/></li>
<li><img src="images/national.png" alt=""/></li>
<li><img src="images/traveller.png" alt=""/></li>
<li><img src="images/progressive.png" alt=""/></li>
<li><img src="images/formost.png" alt=""/></li>
<li><img src="images/the.png" alt=""/></li>
<li><img src="images/circle.png" alt=""/></li>
</ul>
</div>
<a id="popx" type="button" class="btn btn-lg btn-danger" data-toggle="popover" title="Popover title" data-content="">Click to toggle popover</a>
and initialize your popover like this:
<script>
$(function () {
$('#popx').popover({
html: true,
content: function () {
return $('#popover_content').html();
}
});
;
})
</script>

Zurb Foundation Image and text frames, issues with centering and nav-bar max-width

I've been putting this site together, and the series of six images (graphic1.jpg, graphic2.jpg etc) I would like to put into a sort of frame, like the attached image, so that the text always stays under the image, even on mobile if the images were squeezed down single file, and also to give some visual clarity to which bit of text goes to what image.
I'm also having trouble with the two buttons at the bottom of the page centering, despite the fact that I'm using the center code.
Also, is there a resource I can be pointed to to set the width of the nav-bar to a maximum, so that the site can have edges and a background behind/outside of that? I think there's something up with my code there.
Thanks for any help you can provide!
Brookes
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tribal Droid Studio</title>
<link rel="stylesheet" href="css/foundation.css" />
<link rel="stylesheet" type="text/css" href="slick/slick.css"/>
<script src="js/vendor/modernizr.js"></script>
</head>
<body>
<div class="twelve columns centered">
<nav class="top-bar">
<ul class="title-area">
<li class="name"><h1>Tribal Droid Studio</h1></li>
</ul>
<section class="top-bar-section">
<ul class="right">
<li>Visual Development</li>
<li>Sign Work</li>
<li>Our Process</li>
<li>Contact Us</li>
<li>About Tribal Droid</li>
</ul>
</section>
</nav>
<div class="row">
<div class="row">
<div class="large-5 columns">
<h2>Tribal Droid Studio</h2>
<p> asdf asd fasdfasdf asfghwgreqtrgafdbsfgqeth asdf gqfad </p>
</div>
<div class="large-7 columns">
</div>
<div class="large-12 columns">
<img src="img/tribalhead3.jpg"/>
</div>
<hr />
<div class="row">
<h2>Why Tribal Droid Studio?</h2>
<div class="large-12 columns">
<ul class="large-block-grid-3">
<li><img src="img/graphic1.jpg" />Graphic Design, Logo Design, and Branding all go into creating a visual identity.</li>
</panel>
<li><img src="img/graphic2.jpg" />But it can be hard to get noticed in a sea of things demanding attention.</li>
<li><img src="img/graphic3.jpg" />You may find developing one of your own to be lacking in professionalism or soul.</li>
<li><img src="img/graphic4.jpg" />At the heart of your visual identity is a story.</li>
<li><img src="img/graphic5.jpg" />Tribal Droid Studio is a team of artists and storytellers determined to turn your visions into visuals.</li>
<li><img src="img/graphic6.jpg" />Once your identity is ready, we have the signmaking tools and experience to bring it to life.</li>
</div>
<div class="row">
<divclass="small-8 small-centered columns">
<a class="button round"="contact.html">Contact us to get started!</a>
<a class="button round"="#">View our gallery of work</a>
</div>
</div>
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="slick/slick.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.your-class').slick({
setting-name: setting-value
});
});
</script>
<script>
$(document).foundation();
</script>
</body>
</html>
![what I'd like the images and text to do together (font unimportant)][1]
First I'd go through and check your syntax... <divclass="small-8... is invalid. This can cause a break in the layout. Also... check your divs with "row" classes as it seems there are a lot of extras in this example...
I count 9 open <div> tags and only 6 close /div> tags...
For your image issues, set up some sort of css for the images to position them as you need, and then place that image, and the text for it, within a block element on the page. Right now your text is free to flow within the <li> tag and the image is free to float as well. Without some sort of container around them you are going to get separation.

Centering thumbnail gallery with captions without fixed image size

I've tried unsuccessfully to implement the layout in the attached image. When apllied div with table setting IE brokes, if elements are floated when captions are more than one line the layout is broken again. Any suggestion will be greatly appreciated.!
Layout image:
Here is the CSS
.thumbsHolder {clear:both;float:left;width:100%;overflow:hidden;}
.thumbsHolder ul#prodThumbs {padding-top:20px;margin:0 auto;list-style-type:none;text-align:center;}
.thumbsHolder ul#prodThumbs li {float:left;padding:0 7px;min-height:150px;}
.thumbsHolder ul#prodThumbs li a {font-family:Arial, Helvetica, sans-serif;font-weight:normal;text-decoration:none;font-size:70%;}
HTML
<div class="thumbsHolder">
<ul id="prodThumbs">
<li><img src="thumb1.jpg" /> <!-- image width and height may differ -->
<p>Caption</p></li>
<li><img src="thumb2.jpg" />
<p>Longer caption</p>
</li>
<li><img src="thumb3.jpg" />
<p>Even longer caption</p>
</li>
<li><img src="thumb4.jpg" />
<p>Longer caption</p>
</li>
<li><img src="thumb5.jpg" />
<p>Caption this time is a sentence that goes three rows</p>
</li>
<li><img src="thumb6.jpg" />
<p>Caption this time is a sentence that goes three rows</p>
</li>
<li><img src="thumb7.jpg" />
<p>Caption this time is a sentence that goes three rows</p>
</li>
<li><img src="thumb8.jpg" />
<p>Caption this time is a sentence that goes three rows</p>
</li>
<li><img src="thumb9.jpg" />
<p>Since we have a wider image at first row, this row must be centered</p>
</li>
<li><img src="thumb10.jpg" />
<p>Longer caption</p>
</li>
<li><img src="thumb11.jpg" />
<p>Here text also goes down, so if we float layout breaks</p>
</li>
<li><img src="thumb12.jpg" />
<p>Caption</p>
</li>
<li><img src="thumb13.jpg" />
<p>Longer caption</p>
</li>
<li><img src="thumb14.jpg" />
<p>This is a centered image</p>
</li>
<li><img src="thumb15.jpg" />
<p>This is out last image</p>
</li>
</ul>
</div>
You should know what the maximum size of a thumbnail will be when generated on your site, there must be some limit. Why not wrap your tag into a div set that divs height to the max of a thumbnail. Then align the img in the div. Then you have your p tag below for captions

Resources