JFlip jQuery plugin - not loading images - javascript

I want to create a book style page turn effect on some images so I decided to use the JQuery plugin, JFlip. The plugin seems to be doing what it is supposed to do except display the image. I have checked the Network tab and the images are being loaded. Also, I can see the Canvas element JFlip has created but it is just a blank space.
I have some code:
<ul id="g1">
<li>
<img src="img/proforma.jpg">
</li>
<li>
<img src="img/proforma2.jpg">
</li>
</ul>
And some javascript:
<script src="http://code.jquery.com/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.jFlip.js"></script>
<script type="text/javascript">
$("#g1").jFlip(700,230,{background:"green",cornersTop:false});
</script>

It does work, just the plugins are a bit old. See my code below :
HTML:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap.js"></script>
<!--[if IE]><script type="text/javascript" src="http://www.jquery.info/scripts/jFlip/excanvasX.js"></script><![endif]-->
<script src="http://www.jquery.info/scripts/jFlip/jquery.jflip-0.3.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<ul id="g1">
<li>
<img src="http://keith-wood.name/img/calendar.gif">
</li>
<li>
<img src="http://keith-wood.name/img/calendar.gif">
</li>
</ul>
</body>
</html>
JS:
$("#g1").jFlip(700,230,{background:"green",cornersTop:false});
See the full solution here : http://jsbin.com/iqaran/1/edit . Remember to run with js in jsbin
Cheers !

Turns out that script is so old (2008), you need to include the jQuery migrate script.
JSFiddle
Scripts
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.jFlip.js"></script>
HTML
<ul id="g1">
<li>
<img src="http://placehold.it/300x300"/>
</li>
<li>
<img src="http://placehold.it/300x300" />
</li>
</ul>
Also make sure to wrap your executing code in a document.ready so the images get the change to render.
JS
<script>
$(document).ready(function() {
$("#g1").jFlip(700,230,{background:"green",cornersTop:false});
});
</script>

Related

Zurb Foundation JavaScript does not appear to run

I am looking at working with Foundation controls in ASP.Net Core. The controls which use JavaScript don't work - they don't produce errors but they don't do things like move or drop down. The other controls work fine.
Here is the source of one of them. I have added all the JavaScript libraries though some may be referenced by others. The control is displayed but does not move.
I don't know what is missing unless the code needs to be wrapped in other tags.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/Content/foundation.css" rel="stylesheet"/>
<link href="/Content/site.css" rel="stylesheet"/>
</head>
<body>
<div class="slider" data-slider data-initial-start="50" data-end="100">
<span class="slider-handle" data-slider-handle role="slider" tabindex="1"></span>
<span class="slider-fill" data-slider-fill></span>
<input type="hidden">
</div>
<script src="/Scripts/jquery-3.4.1.js"></script>
<script src="/Scripts/foundation.js"></script>
<script src="/Scripts/plugins/foundation.core.js"></script>
<script src="/Scripts/plugins/foundation.slider.js"></script>
<script src="/Scripts/plugins/foundation.util.motion.js"></script>
<script src="/Scripts/plugins/foundation.util.triggers.js"></script>
<script src="/Scripts/plugins/foundation.util.keyboard.js"></script>
<script src="/Scripts/plugins/foundation.util.touch.js"></script>
<script src="/Scripts/plugins/foundation.accordionMenu.js"></script>
<script src="/Scripts/plugins/foundation.util.nest.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>
fixed. The issue was that I should have just linked to foundation.js. However, the "no-js" is not needed but you have to add the "$(document).foundation();" into your source file just before the tag as I have above.

Flexslider JS Not Working

I believe this question has been asked multiple times and I have researched many other articles but I'm afraid I'm at a complete impasse...
I am trying to make a very basic flexslider but it simply does not seem to want to work for me. The images appear as lists, so the HTML and the image links would seem to be Ok. This leads me to believe I have missed something in the JS.
Would anybody be able to advise me?
Many Thanks in advance.
Ryan
<!DOCTYPE html>
<html>
<head>
<!-- Place somewhere in the <head> of your document -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="jquery.flexslider.js"></script>
<!-- Place in the <head>, after the three links -->
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
$('.flexslider').flexslider();
});
</script>
</head>
<body>
<!-- Place somewhere in the <body> of your page -->
<div class="flexslider">
<ul class="slides">
<li>
<img src="../lachantongeimg/group.jpg" alt=""/>
</li>
<li>
<img src="../lachantongeimg/howtojoin.jpg" alt=""/>
</li>
<li>
<img src="../lachantongeimg/playmusic.jpg" alt=""/>
</li>
</ul>
</div>
</body>
</html>
If your photos appear like a list, must be the CSS file. Make sure the file exist or fix your path.
The only difference that I found with the official documentation is the option to animate:
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide"
});
});
here there is a basic example working exactly as you have:
https://jsbin.com/jicodadace/2/edit?html,console,output

Javascript/jquery ul/li animation in php document?

I just started doing some php and I followed one tutorial on udemy page on how to build some simple php website. Now I want to animate the nav bar items border-radius with Js/Jquery. But it doesn't seem to work for me.
I used php include to include navbar into header and then the header into the main php files.
This is my navbar file.
<ul>
<li id="indexx">Home</li>
<li id="teamm">Team</li>
<li id="menuu">Menu</li>
<li id="contactt">Contact</li>
</ul>
And I included that in my headers div id="nav" like this.
<?php
$companyname = "Franklin's Fine Dining";
include ('arrays.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" href="assets/styles.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="includes/animatioon.js"></script>
</head>
<body id="final-example">
<div class="wrapper">
<div id="banner">
<img src="img/banner.png" alt="nema slike jbg." />
</div>
<div id="nav">
<?php include ('includes/nav.php'); ?>
</div>
<div class="content">
My website has main php files like index,menu,team etc. which include the header.
So how can I animate these navbar items so that their border-radius changes when I enter mouse?
Since the navbar is included in header and header in every main php file, I tried to add the source of the jquery and js file in which my code for 'animation' is into my header.php but it doesn't seem to work.
Can someone give me some tips on how should I do it?
Btw this is the code for animation:
$(document).ready(function() {
$('#indexx,#teamm,#menuu,#contactt').mouseenter(function() {
$(this).animate(borderRadius(300),200);
});
THANK you everyone I managed to make it work. But I still have a problem.
This is what my ul and li look like:
Now is there way to animate the li (home,team,menu,contact) border radius since they're a li element? I added the width and the height properties.
But when I do mouseenter I get these changes but the border radius doesn't change, I mean the boxes still don't 'curved'
. I'm sorry in advance for maybe asking stupid questions and for bad explanation but I'm only beginner in this, as I said I followed tutorial on how to build this web page.
remember that php is a server-side language that helps you build dynamic HTML. so make sure that you pre-include all the JavaScript you need for anything that happens on the client-side. see my example below, I assumed that your jquery selector is correct.
<head>
<meta charset="utf-8">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" href="assets/styles.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="includes/animatioon.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#indexx,#teamm,#menuu,#contactt').mouseenter(function() {
$(this).animate(borderRadius(300),200);
});
});
</script>
</head>
I am suggesting to write your inline Script before close of body tag </body>.
Also suggest you one improvement in jQuery selector. if you want to effect in all <li> tag of then dont use id.
your nav.php
<ul id="my_navbar">
<li >Home</li>
<li >Team</li>
<li >Menu</li>
<li >Contact</li>
</ul>
Your index.php file
<?php
$companyname = "Franklin's Fine Dining";
include ('arrays.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" href="assets/styles.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="includes/animatioon.js"></script>
</head>
<body id="final-example">
<div class="wrapper">
<div id="banner">
<img src="img/banner.png" alt="nema slike jbg." />
</div>
<div id="nav">
<?php include ('includes/nav.php'); ?>
</div>
<div class="content">
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#my_navbar li').mouseenter(function() {
$(this).animate(borderRadius(300),200);
});
});
</script>
</body>
</html>

Jquery multiple classes not working on mobile browsers - how do I trace the conflicts?

I'm trying to figure out why my navigation menu will not work within mobile browsers. Ive tried android and chrome mobile and it doesnt work. Sometimes if I load the page, then navigate to a new page, and come back, the menutoggle works fine, but it does not seem to work: mshake.honeybadgerofmoney.com in the upper right corner. BUT right click > inspect element then click the mobile phone icon to simulate a mobile browser to see the behavior I'm referencing.
The menu appears on mobile, but it does not navigate to the anchor link as it should. I've tried to:
change the loading order of the scripts loading in my header tag
<span>Menu</span>
<div id="menu">
<ul>
<li>About</li>
<li>Work Samples</li>
<li>Services We Provide</li>
<li>Contact Us</li>
</ul>
</div>
</li>
</ul>
</nav>
and the JS portion:
<!-- Scripts -->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.scrollex.min.js"></script>
<script src="js/jquery.scrolly.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/contact.js"></script>
<!-- Add fancyBox -->
<link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<!-- Optionally add helpers - button, thumbnail and/or media -->
<link rel="stylesheet" href="/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
<script type="text/javascript" src="/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
<link rel="stylesheet" href="/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
<script type="text/javascript" src="/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
Any ideas?

Flexslider doesn't show images

I have added flexslider js and css files, also added the slider block code as the official sample had added them. In the result, i can't see the images in any browser, but in "View Source" mode, i can see the changes has made by js file and there isn't any problem in there.
When i removed the css or the js file from images were shown properly, but when i added them again, prev, next and navigation links are added but images disapear.
What should i do?
My codes:
<head>
<meta charset="utf-8">
<title>Untitled</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="jquery.flexslider-min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="flexslider.css">
</head>
And my code for the slider block:
<div class="flexslider">
<ul class="slides">
<li>
<img src="slide1.jpg" />
</li>
<li>
<img src="slide2.jpg" />
</li>
<li>
<img src="slide3.jpg" />
</li>
<li>
<img src="slide4.jpg" />
</li>
</ul>
</div>
And js code to enable flexslider:
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide"
});
});

Categories

Resources