MooTools accordion mouseover - mootools

I saw on the internet a accordion with mootools. But this is a click-event. I want to have a mouseover for to open the accordion. I have tied, but it doesn't work.
Can someone help me? Thanks in advance
window.addEvent('domready', function()
{
var myAccordion = new Accordion
(
$('accordion'), 'div.toggler', 'div.element',
{
opacity: false,
display: 0,
alwaysHide: true,
// WHEN A PART IS OPEN
onActive: function(toggler, element)
{
toggler.setStyle('color', '#FF4A6F');
},
// WHEN A PART IS CLOSED
onBackground: function(toggler, element)
{
toggler.setStyle('color', '#585858');
}
// END ACCORDION H3, DIV.ELEMENT
}
// END VAR NEW ACCORDION
);
// END FUNCTION
});
my html:
<div id="homeBox_img">
<div id="slideshow-container">
<img src="img/image1.jpg" width="345" height="301" alt="introducing img" />
<img src="img/image2.jpg" alt="introducing img" />
<img src="img/image3.jpg" width="345" height="301" alt="introducing img" />
</div>
</div>

To build an accordion successfully, there must be the collection of toggler elements ( like h2 elements in example below ), and the collection of content elements ( '.content' ). I do not see what html that you have added has to do with the script, but here is an basic example where the change of elements is triggered with 'mouseenter' event.
JS:
new Fx.Accordion(
'#accordion h2', '#accordion .content', { trigger: 'mouseenter' }
);
HTML:
<div id="accordion">
<h2>image1</h2>
<div class="content">
<img src="img/image1.jpg" width="345" height="301" alt="introducing img" />
</div>
<h2>image2</h2>
<div class="content">
<img src="img/image2.jpg" width="345" height="301" alt="introducing img" />
</div>
<h2>image3</h2>
<div class="content">
<img src="img/image3.jpg" width="345" height="301" alt="introducing img" />
</div>
http://mootools.net/docs/more/Fx/Fx.Accordion#Fx-Accordion
http://mootools.net/demos/?demo=Accordion

Related

Slick Slider Carousel not showing slides at the start and scrolling is always different

I am trying to "implement" slick-slider in React like this:
I am building a site through Gatsby, don't know if that is important information, but will include it just in case.
But when I develop a site through Gatsby this is the type of behavior I get:
Take a careful look at how different selected slide doesn't always move in correct margin. It is always different/moves more and more to the right.
This is part of my code with Slick Slider settings:
const IndexPage = () => {
const settings =
{
className: "center",
centerPadding: "60px",
infinite: true,
centerMode: true,
slidesToShow: 1,
dots: true,
arrows: true,
swipe: true,
swipeToSlide: true,
variableWidth: true,
responsive: [
{
breakpoint: 850,
settings:
{
centerMode: false,
},
},],
};
return (
<Page>...
And this is the part where I try to render the slider:
<div className="activities">
<div className="z">
<div className="activities-container">
<h1 className="title title-light no-margin">
...
</h1>
<p className="container-fluid block1-paragraph activities-paragraph">
...
</p>
</div>
<div>
<Slider {...settings}>
<div>
<img className="slide-img" src={jedan} alt="" />
</div>
<div>
<img className="slide-img" src={dva} alt="" />
</div>
<div>
<img className="slide-img" src={tri} alt="" />
</div>
<div>
<img className="slide-img" src={cetiri} alt="" />
</div>
<div>
<img className="slide-img" src={pet} alt="" />
</div>
<div>
<img className="slide-img" src={sest} alt="" />
</div>
<div>
<img className="slide-img" src={sedam} alt="" />
</div>
<div>
<img className="slide-img" src={osam} alt="" />
</div>
<div>
<img className="slide-img" src={devet} alt="" />
</div>
<div>
<img className="slide-img" src={deset} alt="" />
</div>
</Slider>
</div>
</div>
</div>
I left all of the divs the slider is just in case the problem isn't the slider itself.
What is the cause of this issue? Any help is appreciated!!!

Closing multiple popups one at a time

I have three popups that appear when the page loads, and only the first one is displayed while the rest is hidden. Each popup contains an image.
<div class="popup-container" tabindex="0">
<div class="popup-wrapper"> //1st popup
<img src="/popup/image-1.jpg" alt="photo">
</div>
<div class="popup-wrapper"> //2nd popup
<img src="/popup/image-2.jpg" alt="photo">
</div>
<div class="popup-wrapper"> //3rd popup
<img src="/popup/image-3.jpg" alt="photo">
</div>
</div>
The 2nd and 3rd popups have a display set to none via css.
.popup-wrapper:nth-child(n+2) {
display: none;
}
My question is how can I show the second popup after closing the first one, and so on from the second popup to third using ESC key.
So far here's my jquery:
$(".popup-container").on("keydown", function(e) {
if(e.which == 27) {
$(".popup-container .popup-wrapper").hide(); //closes the currently shown popup
}
});
You can use next and show since they are siblings.
$(".popup-container").on("keydown", function(e) {
if (e.which == 27) {
$(".popup-container .popup-wrapper:visible")
.hide()
.next()
.show();
}
});
.popup-wrapper:nth-child(n+2) {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="popup-container" tabindex="0">
<div class="popup-wrapper"> //1st popup
<img src="/popup/image-1.jpg" alt="photo">
</div>
<div class="popup-wrapper"> //2nd popup
<img src="/popup/image-2.jpg" alt="photo">
</div>
<div class="popup-wrapper"> //3rd popup
<img src="/popup/image-3.jpg" alt="photo">
</div>
</div>

Vue and API: Displaying Image

I am currently using Vue JS and the data is coming from API .
to call a data from API I use this method {{services.service_picture}}.
But the problem is I am unable to display the image with this method below.
Can you please send some ideas on how to display it using Vue JS
<div id="main" v-cloak>
<div class="col-sm-5">
<p v-for="picture in services.service_picture"></p>
<img :src="path + '/images/services/'+ picture" class="img-circle" alt="Services" /> </div>
</div>
var main = new Vue({
el: "#main",
data: {
services: [],
path: 'https://examplemyapisource.com'
},
});
API from https://examplemyapisource.com
[
{ "service_picture": "18_1516090191.jpg", } ]
You try here:
<div id="main" v-cloak>
<div class="col-sm-5">
<p v-for="picture in services"></p>
<img :src="path + '/images/services/'+ picture.service_picture" class="img-circle" alt="Services" /> </div>
</div>
Credits to Huang Hong
<img :src="path+'/images/services/'+services.service_picture" class="img-circle" alt="Services">
Note the your v-for only includes the element, therfore you cannot use 'picture' inside the element.
<p v-for="picture in services.service_picture"></p>
<img :src="path + '/images/services/'+ picture" class="img-circle" alt="Services" />
You need to make these changes to get a perfect image.
Here you closed the <p> tag before the image.close that <p> tag after image
<div id="main" v-cloak>
<div class="col-sm-5">
<p v-for="picture in services">
<img :src="path + '/images/services/'+ picture.service_picture" class="img-circle" alt="Services" /> </div>
</p>
</div>

How to drag a template which is a image in one div and drop it in another div so that it opens as a page?

html:
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="one">
<p id="drag1" ><img src = "e:\Atom\UI\images\Capture.PNG" alt="home page" /> </p>
<p id="drag2"><img src = "e:\Atom\UI1\images\Capture2.JPG" alt="home page" /> </p>
</div>
</div>
<div class="col-md-8"> <div id="droppable" class="ui-sortable" ><ol></ol></div></div>
</div>
</div>
jquery ui:
$(function() {
$( "#drag1" ).draggable({ appendTo: "body", helper: "clone"});
$( "#drag2" ).draggable({ appendTo: "body", helper: "clone"});
$( "#droppable" ).droppable({
drop: function(event,ui){
});
});
when the image is dropped in the droppable div we should be able to modify the contents of the page(template) dropped that is we can change the title of the page, add/delete textbox, button, label...etc

How i can hide and show the image in jquery mobile

I am making one android app with help of phonegap.I need help how i can hide the image or show the image when i wanted
when my toggleswitch is off then my image which is in third page should hide if my toggleswitch is on then it will show the image
plz help me out how i can do
In HTML5:-
<div data-role="page" id="page1">
<div data-role="content">
<select name="toggleswitch1" id="toggleswitch1" data-theme="" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>
<a data-role="button" id="button1" data-inline="true" href="#" onclick="clickfn();">Button</a>
</div>
<div data-role="page" id="page2">
<div data-role="content">
<p>some text</p><p>some text</p>
<a data-role="button" id="button2" data-inline="true" href="#page3" >Button</a>
</div>
<div data-role="page" id="page3">
<div data-role="content">
<p>some text</p><p>some text</p>
<img src="xyz image" />
<a data-role="button" id="button3" data-inline="true" href="#page1" >Button</a>
</div>
in jquery:-
$(document).unbind('pageinit').bind('pageinit', function () {
clickfn();
});
function clickfn(){
$('#button1').click(function(){
if($("#toggleswitch1 option:selected").val() == 'off'){
$.mobile.changePage("#page2");
}else{
$.mobile.changePage("#page2");
}
});
}
there is property called .hide and .show where you can show or hide the images.
Let us say the id of your image is img, then
$('#button).click(function(){
if($("#toggleswitch1 option:selected").val() == 'off'){
$("#img").hide ();
}else{
$("#img").show ();
}
Add a id in your img
<img id="myimg" src="xyz image" />
And swicth the visibility in code
function clickfn(){
$('#button1').click(function(){
if($("#toggleswitch1 option:selected").val() == 'off'){
$("#myimg").hide ();
}else{
$("#myimg").show ();
}
});
}