How to animate multi form process with ajax jquery and php? - php

Through PHP the steps are counted and added in a session to avoid returning to the beginning in case of updating or refreshing the page, the value is obtained by means of the following variable $step
<?php
session_start();
if ( !empty($_SESSION['datos_form']['__step__'])) {
$step = $_SESSION['datos_form']['__step__'];
} else {
$step = '1';
}
?>
We receive the value of the variable in the jQuery javascript code.
show_step(<?= $step; ?>);
That would be equal to: (for the default value received)
show_step(1);
Each step of the process is shown according to the value received from PHP to the Javascript code as it was already mentioned.
Without the need to add additional controls like the following:
current = $(this).parent();
next = $(this).parent().next();
I have the following simple wizard with CSS
https://jsfiddle.net/2LL8x1sm/
I need to be able to adapt it to the ajax javascript code so that it animates the step in which it is.
The current code already had an animation using a technique called sprite
function animacion(caso){}
What I need is to be able to adapt the animation of the process, and using an icon (like this one) that goes sliding with the bar of progress similar to the following image:
This animation must be added inside the function animacion(caso) {} that works together with the back links and continue, add an example within the fuction in the following code:
$( ".test" ).animate({ "left": "-=50px" }, "slow" );
And in effect it works, the div with the test class was modifying the left style by continuing in each step.
How can I animate the process of my html code css?
$(function() {
show_step(<?= $step; ?>);
});
function animacion(caso){
//$( ".test" ).animate({ "left": "-=50px" }, "slow" );
};
// function to save the form data and change the step
function show_step(step){
var data = $( "#form" ).serialize();
var url = 'saveTemp.php?step=' + step;
$.ajax({
type: "POST",
url: url,
data: data
})
.done(function( resp ) {
$('.step').css( "display", "none" );
$('#step'+step).fadeIn("slow");
//animation of each step
animacion(step);
});
};
.container {
width: 100%;
padding-top: 20px;
}
.progressbar li {
list-style-type: none;
float: left;
width: 33.33%;
position: relative;
text-align: center;
}
.progressbar li > * {
position: relative;
padding-bottom: 20px;
display: inline-block;
font-size: 1.4rem;
color: #2c3f4c;
top: -45px;
}
.progressbar li:before {
content: '';
width: 12px;
height: 12px;
display: block;
text-align: center;
margin: 0 auto;
border-radius: 50%;
background-color: #edeff0;
}
.progressbar li:after {
content: '';
position: absolute;
width: 100%;
height: 4px;
background-color: #edeff0;
top: 4px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: green;
}
.progressbar li.active:before {
background-color: green;
}
.progressbar li.active + li:after {
background-color: green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- <div class="test"></div> -->
<div class="container">
<ul class="progressbar">
<li class="active"><span>Step 1</span></li>
<li><span>Step 2</span></li>
<li><span>Step 3</span></li>
</ul>
</div>
<form id="form" action="procesar.php">
<div id="step1" class="step">
<h1>step 1</h1>
<a data-ref="#" onclick="show_step(2)">continue</a>
</div>
<div id="step2" class="step">
<h1>step 2</h1>
<a data-ref="#" onclick="show_step(1)">after</a>
<a data-ref="#" onclick="show_step(3)">continue</a>
</div>
<div id="step3" class="step">
<h1>step 3</h1>
<a data-ref="#" onclick="show_step(2)">after</a>
<button>Send</button>
</div>
</form>

Is this correct understanding of what you need?
function animacion(caso) {
if (!caso) {
document.getElementsByClassName("progressbar")[0].setAttribute("data-active", "");
} else {
document.getElementsByClassName("progressbar")[0].setAttribute("data-active", caso);
}
var items = document.getElementsByTagName("li");
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (!caso) {
item.className = "";
} else if (i < caso) {
item.className = "active";
} else {
item.className = "";
}
}
}
setTimeout(function () {
animacion(1);
}, 1000);
setTimeout(function () {
animacion(2);
}, 2000);
setTimeout(function () {
animacion(3);
}, 3000);
setTimeout(function () {
animacion(2);
}, 4000);
setTimeout(function () {
animacion(1);
}, 5000);
setTimeout(function () {
animacion(null);
}, 6000);
.container {
width: 100%;
}
.progressbar {
counter-reset: step;
}
.progressbar li {
list-style-type: none;
float: left;
width: 33.33%;
position: relative;
text-align: center;
}
.progressbar li > * {
position: relative;
padding-bottom: 20px;
display: inline-block;
font-size: 1.4rem;
color: #2c3f4c;
top: -45px;
/* new code start */
top: -65px;
/* new code end */
}
.progressbar li:before {
content: '';
width: 12px;
height: 12px;
display: block;
text-align: center;
margin: 0 auto;
border-radius: 50%;
background-color: #edeff0;
}
.progressbar li:after {
content: '';
position: absolute;
width: 100%;
height: 4px;
background-color: #edeff0;
top: 4px;
left: -50%;
z-index: -1;
}
.progressbar li:first-child:after {
content: none;
}
.progressbar li.active {
color: green;
}
.progressbar li.active:before {
background-color: green;
/* new code start */
-webkit-transition: background 300ms ease;
transition: background 300ms ease;
-webkit-transition-delay: 300ms;
transition-delay: 300ms;
/* new code end */
}
/* removed code start */
/*
.progressbar li.active + li:after {
background-color: green;
}
*/
/* removed code end */
/* new code start */
.progressbar {
position: relative;
padding: 0;
margin: 0;
}
.progressbar:after {
content: "";
height: 4px;
left: 16.666%;
background: green;
top: 4px;
position: absolute;
-webkit-transition: width 300ms ease;
transition: width 300ms ease;
}
.progressbar[data-active="1"]:after {
width: 0;
}
.progressbar[data-active="2"]:after {
width: 33%;
}
.progressbar[data-active="3"]:after {
width: 66%;
}
.progressbar[data-active=""]:before {
opacity: 0;
}
.progressbar:not([data-active=""]):before {
opacity: 1;
-webkit-transition: left 300ms ease, opacity 300ms ease;
transition: left 300ms ease, opacity 300ms ease;
}
.progressbar[data-active="1"]:before {
left: 16.666%;
}
.progressbar[data-active="2"]:before {
left: 50%;
}
.progressbar[data-active="3"]:before {
left: 83.333%;
}
.progressbar:before {
content: "";
height: 16px;
width: 16px;
margin-top: -24px;
margin-left: -8px;
left: 16.666%;
background: khaki;
top: 4px;
position: absolute;
-webkit-transition: left 300ms ease;
transition: left 300ms ease;
}
/* new code end */
<div class="container">
<br><br><br><br><br><br>
<ul class="progressbar" data-active="">
<li><span>Step 1</span></li>
<li><span>Step 2</span></li>
<li><span>Step 3</span></li>
</ul>
</div>
There is minor change in markup and style. Rectange indicates block where you can insert your icons.

Related

Convert Youtube iframe to lite-youtube tag

I am looking for the best solution to mass convert my HTML video code into lite-youtube embed tags.
Example
<div class="videoWrapper">
<iframe frameborder="0" height="315" src="https://www.youtube.com/embed/xxxxxCODE?rel=0" width="560"></iframe>
</div>
into this
<div class="videoWrapper">
<lite-youtube videoid="xxxxxCODE" params="controls=1&modestbranding=2&rel=0&enablejsapi=1"></lite-youtube>
</div>
Do you have any suggestion to mass convert it? (html data is in mysql database)
thanks
Use the following code snippet. Remember to replace VIDEO_ID with the actual ID of your YouTube video.
See details from here.
function labnolIframe(div) {
var iframe = document.createElement('iframe');
iframe.setAttribute(
'src',
'https://www.youtube.com/embed/' + div.dataset.id + '?autoplay=1&rel=0'
);
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('allowfullscreen', '1');
iframe.setAttribute(
'allow',
'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
);
div.parentNode.replaceChild(iframe, div);
}
function initYouTubeVideos() {
var playerElements = document.getElementsByClassName('youtube-player');
for (var n = 0; n < playerElements.length; n++) {
var videoId = playerElements[n].dataset.id;
var div = document.createElement('div');
div.setAttribute('data-id', videoId);
var thumbNode = document.createElement('img');
thumbNode.src = '//i.ytimg.com/vi/ID/hqdefault.jpg'.replace(
'ID',
videoId
);
div.appendChild(thumbNode);
var playButton = document.createElement('div');
playButton.setAttribute('class', 'play');
div.appendChild(playButton);
div.onclick = function () {
labnolIframe(this);
};
playerElements[n].appendChild(div);
}
}
document.addEventListener('DOMContentLoaded', initYouTubeVideos);
<style>
.youtube-player {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
background: #000;
margin: 5px;
}
.youtube-player iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100;
background: transparent;
}
.youtube-player img {
object-fit: cover;
display: block;
left: 0;
bottom: 0;
margin: auto;
max-width: 100%;
width: 100%;
position: absolute;
right: 0;
top: 0;
border: none;
height: auto;
cursor: pointer;
-webkit-transition: 0.4s all;
-moz-transition: 0.4s all;
transition: 0.4s all;
}
.youtube-player img:hover {
-webkit-filter: brightness(75%);
}
.youtube-player .play {
height: 72px;
width: 72px;
left: 50%;
top: 50%;
margin-left: -36px;
margin-top: -36px;
position: absolute;
background: url('//i.imgur.com/TxzC70f.png') no-repeat;
cursor: pointer;
}
</style>
<div class="youtube-player" data-id="L2mX-Yh9krE"></div>

owl-carousel automatic slider not working

css: owl.carousel.min.css
.owl-carousel,
.owl-carousel .owl-item {
-webkit-tap-highlight-color: transparent;
position: relative
}
.owl-carousel {
display: none;
width: 100%;
z-index: 1
}
.owl-carousel .owl-stage {
position: relative;
-ms-touch-action: pan-Y;
-moz-backface-visibility: hidden
}
.owl-carousel .owl-stage:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0
}
.owl-carousel .owl-stage-outer {
position: relative;
overflow: hidden;
-webkit-transform: translate3d(0, 0, 0)
}
.owl-carousel .owl-item,
.owl-carousel .owl-wrapper {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0)
}
.owl-carousel .owl-item {
min-height: 1px;
float: left;
-webkit-backface-visibility: hidden;
-webkit-touch-callout: none
}
.owl-carousel .owl-item img {
display: block;
width: 100%
}
.owl-carousel .owl-dots.disabled,
.owl-carousel .owl-nav.disabled {
display: none
}
.no-js .owl-carousel,
.owl-carousel.owl-loaded {
display: block
}
.owl-carousel .owl-dot,
.owl-carousel .owl-nav .owl-next,
.owl-carousel .owl-nav .owl-prev {
cursor: pointer;
cursor: hand;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none
}
.owl-carousel.owl-loading {
opacity: 0;
display: block
}
.owl-carousel.owl-hidden {
opacity: 0
}
.owl-carousel.owl-refresh .owl-item {
visibility: hidden
}
.owl-carousel.owl-drag .owl-item {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none
}
.owl-carousel.owl-grab {
cursor: move;
cursor: grab
}
.owl-carousel.owl-rtl {
direction: rtl
}
.owl-carousel.owl-rtl .owl-item {
float: right
}
.owl-carousel .animated {
animation-duration: 1s;
animation-fill-mode: both
}
.owl-carousel .owl-animated-in {
z-index: 0
}
.owl-carousel .owl-animated-out {
z-index: 1
}
.owl-carousel .fadeOut {
animation-name: fadeOut
}
#keyframes fadeOut {
0% {
opacity: 1
}
100% {
opacity: 0
}
}
.owl-height {
transition: height .5s ease-in-out
}
.owl-carousel .owl-item .owl-lazy {
opacity: 0;
transition: opacity .4s ease
}
.owl-carousel .owl-item img.owl-lazy {
transform-style: preserve-3d
}
.owl-carousel .owl-video-wrapper {
position: relative;
height: 100%;
background: #000
}
.owl-carousel .owl-video-play-icon {
position: absolute;
height: 80px;
width: 80px;
left: 50%;
top: 50%;
margin-left: -40px;
margin-top: -40px;
background: url(owl.video.play.html) no-repeat;
cursor: pointer;
z-index: 1;
-webkit-backface-visibility: hidden;
transition: transform .1s ease
}
.owl-carousel .owl-video-play-icon:hover {
-ms-transform: scale(1.3, 1.3);
transform: scale(1.3, 1.3)
}
.owl-carousel .owl-video-playing .owl-video-play-icon,
.owl-carousel .owl-video-playing .owl-video-tn {
display: none
}
.owl-carousel .owl-video-tn {
opacity: 0;
height: 100%;
background-position: center center;
background-repeat: no-repeat;
background-size: contain;
transition: opacity .4s ease
}
.owl-carousel .owl-video-frame {
position: relative;
z-index: 1;
height: 100%;
width: 100%
}
.owl-carousel .owl-wrapper-outer{
overflow: hidden;
position: relative;
width: 100%;
z-index: 1;
}
.owl-item {
transform: translateZ(0);
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
}
index.php
<script>
$(document).ready(function(){
$(".owl-carousel").owlCarousel({
navigation : false,
rtl:true,
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true
});
});
</script>
<div class="col-xl-12">
<div class="product-tab-content">
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<div class="product-active owl-carousel">
<?php
foreach($deal as $row)
{
$img = explode(",",$row['product_image']);
?>
<div class="pro-item">
<div class="product-wrapper">
<div class="product-img">
<a href="<?php echo base_url(); ?>details/<?php echo $row['product_id']; ?>">
<?php
if(!empty($img[0]))
{
?>
<img src="<?php echo base_url(); ?>product/<?php echo $img[0]; ?>" alt="">
<?php
}
else
{
?>
<img src="<?php echo base_url(); ?>product/product_not.jpeg">
<?php
}
?>
</a>
</div>
<div class="product-content pt-15">
<h4>
<?php echo $row['product_name']; ?>
</h4>
<div class="product-meta">
<div class="pro-price f-left">
<span><?php echo $row['unit_price']; ?></span>
<span class="old-price"><?php echo $row['old_price']; ?></span>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
I am developing a eCommerce website where I am showing some product which are perfectly showing and previous and next button are also working perfectly but product are not sliding automatically. I had tried so many thing like jquery, css but I am not able to find any solution. How can I automatically slide my product? Please help me.
Thank You
put your js code below the html and add the line (autoplay:true) to the function.
$(document).ready(function(){
$(".owl-carousel").owlCarousel({
navigation : false,
rtl:true,
slideSpeed : 300,
paginationSpeed : 400,
autoplay:true,
singleItem:true
});
});
You could use Swiper is better than owl carousel.
Swiper
- is the free and most modern mobile touch slider with hardware accelerated transitions and amazing native behavior. It is intended to be used in mobile websites, mobile web apps, and mobile native/hybrid apps. Designed mostly for iOS, but also works great on latest Android, Windows Phone 8 and modern Desktop browsers.
Swiper is not compatible with all platforms, it is a modern touch
slider which is focused only on modern apps/platforms to bring the
best experience and simplicity.
In the owl.carousel.js file
search for transform you should find something like this
transform: 'translate3d("+b+"px,0px,0px)'
see this "+b+" replace it with "+-b+" it ends up like this
transform: "translate3d(" + -b + "px,0px, 0px)"
Notes this will not work in ltr versions so in my case I am using dynamic application so made 2 files and I called the English version without minus " + b + " and the rtl I added this minus.
it may help someone.

How to Change Mobile Menu Icon Using PHP (Toggling Hamburger Menu)

I'm using the hamburger toggling method from the AMP-WP website and replaced the text with a symbol ☰ to create the hamburger.
https://amp-wp.org/documentation/playbooks/toggling-hamburger-menus/
<?php echo( '☰' ); ?>
Everything works great, apart from I'd like to change the symbol to ✕ when the menu is open/active.
What PHP is required to do this please?
You need to take a different approach where your icon is really a set of HTML elements where each line is separate and can be targeted by animation, CSS transforms in this case:
const hamburger = document.querySelector('#hamburger-toggle');
hamburger.addEventListener('click', function() {
if (this.classList.contains('open')) {
this.classList.remove('open');
} else {
this.classList.add('open');
}
});
#hamburger-toggle {
position: relative;
cursor: pointer;
height: 40px;
width: 50px;
margin: 10px 0;
padding: 10px 0;
}
.hamburger-line {
display: block;
width: 24px;
height: 2px;
background-color: black;
margin-top: 6px;
opacity: 1;
}
.hamburger-line-1 {
margin-top: 0;
}
.hamburger-line-1, .hamburger-line-3 {
transform-style: preserve-3d;
transition: transform 200ms; /* this line animates the change in position */
transform: translateY(0px) rotateZ(0deg);
}
.hamburger-line-2 {
transition: opacity 200ms; /* this line animates the change in opacity fading in/out the middle hamburger line */
}
#hamburger-toggle.open .hamburger-line-1 {
transform-style: preserve-3d;
transition: transform 200ms;
transform: translateY(8px) rotateZ(44deg);
}
#hamburger-toggle.open .hamburger-line-2 {
transition: opacity 200ms;
opacity: 0;
}
#hamburger-toggle.open .hamburger-line-3 {
transform-style: preserve-3d;
transition: transform 200ms;
transform: translateY(-8px) rotateZ(-44deg);
}
<div id="hamburger-toggle">
<span class="hamburger-line hamburger-line-1"></span>
<span class="hamburger-line hamburger-line-2"></span>
<span class="hamburger-line hamburger-line-3"></span>
</div>

rotate and move image to the right when hovering over another div

I want to hover over an image (music album) and then a record rolls out, so I want it to move to the right and to rotate a bit. It can already move to the right but I can't get it to rotate with it.
the #cover1 is the album and the #coverrecord1 is the record that needs to roll out, i like to keep it as simple as possible as i am not a pro in coding.
Many thanks.
$(document).ready(function (){
$("#cover1").hover(
function() {
$("#coverrecord1").stop().animate({ left: '5%' });
},
function() {
$("#coverrecord1").stop().animate({ left: '0' });
}
);
});
You can also skip js if you wish :)
.album {
background-color: orange;
height: 10em;
margin: 3em auto;
position: relative;
width: 10em;
}
.album:after, .album:before {
content: "";
display: block;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
.album:after {
background-color: orange;
z-index: 1;
}
.album:before {
background-image: linear-gradient(to left, gray, black);
border-radius: 50%;
transition: transform 500ms;
}
.album:hover:before {
transform: translate3d(40%, 0%, 0) rotate(30deg);
}
<div class="album"></div>

CSS jquery put 4 more links in slider

i want to put 6 more links on my jQuery slider my site link : http://daplonline.in/
NOTE only for first image not for all images.
i want to make something like this: http://daplonline.in/images/ineed.jpg
But my code is not working. Can anyone give me a solution how to build this?
My CSS code
/*--Main Image Preview--*/
.main_image {
width: 598px; height: 460px;
float: left;
background: #333;
position: relative;
overflow: hidden;
color: #fff;
}
.main_image h2 {
font-size: 2em;
font-weight: normal;
margin: 0 0 5px; padding: 10px;
}
.main_image h2 { display: none; }
.main_image p {
font-size: 1.2em;
padding: 10px; margin: 0;
line-height: 1.6em;
}
.block small {
padding: 0 0 0 20px;
background: url(images/icon_cal.gif) no-repeat 0 center;
font-size: 1em;
display:none;
}
.main_image .block small {margin-left: 10px;}
.main_image .desc{
position: absolute;
bottom: 0; left: 0;
width: 100%;
display:none;
}
.main_image .block{
}
.main_image a.collapse {
background: url(images/btn_coll.gif) no-repeat left top;
height: 27px; width: 93px;
text-indent: -99999px;
position: absolute;
top: -27px; right: 20px;
}
.main_image a.show {background-position: left bottom;}
.image_thumb {
float: left;
width: 299px;
background: #f0f0f0;
border-right: 1px solid #fff;
border-top: 1px solid #ccc;
}
.image_thumb img {
border: 1px solid #ccc;
padding: 5px;
background: #fff;
float: left;
}
.image_thumb ul {
margin: 0; padding: 0;
list-style: none;
}
.image_thumb ul li{
margin: 0; padding: 20px 10px;
background: #f0f0f0 url(../images/nav_a.gif) repeat-x;
width: 279px;
float: left;
border-bottom: 1px solid #ccc;
border-top: 1px solid #fff;
border-right: 1px solid #ccc;
}
.image_thumb ul li.hover {
background: #ddd;
cursor: pointer;
}
.image_thumb ul li.active {
background: #fff;
cursor: default;
}
html .image_thumb ul li h2 {
font-size: 1.4em;
margin: 5px 0; padding: 0;
vertical-align:central;
}
.image_thumb ul li .block {
float: left;
margin-left: 10px;
padding: 0;
width: 180px;
}
.image_thumb ul li p{display: none;}
and my jquery is
<script type="text/javascript">
var intervalId;
var slidetime = 2500; // milliseconds between automatic transitions
$(document).ready(function() {
// Comment out this line to disable auto-play
intervalID = setInterval(cycleImage, slidetime);
$(".main_image .desc").show(); // Show Banner
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); // Set Opacity
// Click and Hover events for thumbnail list
$(".image_thumb ul li:first").addClass('active');
$(".image_thumb ul li").click(function(){
// Set Variables
var imgAlt = $(this).find('img').attr("alt"); // Get Alt Tag of Image
var imgTitle = $(this).find('a').attr("href"); // Get Main Image URL
var imgDesc = $(this).find('.block').html(); // Get HTML of block
var imgDescHeight = $(".main_image").find('.block').height(); // Calculate height of block
if ($(this).is(".active")) { // If it's already active, then...
return false; // Don't click through
} else {
// Animate the Teaser
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 150 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
}
$(".image_thumb ul li").removeClass('active'); // Remove class of 'active' on all lists
$(this).addClass('active'); // add class of 'active' on this list only
return false;
}) .hover(function(){
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
// Toggle Teaser
$("a.collapse").click(function(){
$(".main_image .block").slideToggle();
$("a.collapse").toggleClass("show");
});
// Function to autoplay cycling of images
// Source: http://stackoverflow.com/a/9259171/477958
function cycleImage(){
var onLastLi = $(".image_thumb ul li:last").hasClass("active");
var currentImage = $(".image_thumb ul li.active");
if(onLastLi){
var nextImage = $(".image_thumb ul li:first");
} else {
var nextImage = $(".image_thumb ul li.active").next();
}
$(currentImage).removeClass("active");
$(nextImage).addClass("active");
// Duplicate code for animation
var imgAlt = $(nextImage).find('img').attr("alt");
var imgTitle = $(nextImage).find('a').attr("href");
var imgDesc = $(nextImage).find('.block').html();
var imgDescHeight = $(".main_image").find('.block').height();
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
};
$('.main_image').on("mouseover",function(){
clearInterval(intervalID);
});
$('.main_image').on("mouseout",function(){
intervalID = setInterval(cycleImage, slidetime);
});
$('.image_thumb ul li').on("mouseover",function(){
clearInterval(intervalID);
});
$('.image_thumb ul li').on("mouseout",function(){
intervalID = setInterval(cycleImage, slidetime);
});
});// Close Function
</script>
One solution. Put all these 4 Links on the image itself & then use MAP like following :-
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_areamap
<img src="images/banner1.png" alt="magic rabbit in the hat" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Register" href="register.htm">
<area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
<area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
You will have to set the coordinates correctly.
New :-
$(document).ready(function() {
var match_img = $('img[src="images/banner1.png"]');
match_img.attr("usemap", "#planetmap");
// Rest of ur Code
});

Categories