Ionic 2 slides autoplay - ionic2

I am using ionic2.
Here is my template
<ion-slides autoplay="5000" loop="true" speed="500" pager="true">
<ion-slide class="slider1">
<h1>My <span>Neighbours</span></h1>
<p>My Neighbours is a directory of people who live in the building and have chosen to</p>
<div class="homepeople">
<div class="home"></div>
<div class="people"></div>
</div>
</ion-slide>
<ion-slide class="slider2">
<h1>CCTV <span>Monitoring</span></h1>
<p>Residents/Managers can view selected CCTV</p>
<div class="iconholder">
<img src="./assets/images/white CCTV Monitoring.svg" alt="Image">
</div>
</ion-slide>
<ion-slide class="slider3">
<h1>Emergency</h1>
<p>Security / Reception / Police / Ambulance / Fire</p>
<div class="iconholder">
<div class="iconholder-blk">
<img src="./assets/images/white emergency icon.svg" alt="Image">
</div>
<div class="iconholder-blk">
<img src="./assets/images/white Alarm.svg" alt="Image">
</div>
</div>
<button ion-button outline small (click)="navHome()">
Start using the app
</button>
</ion-slide>
</ion-slides>
It's work perfect.But i need loop does not continue on when last slide.
How can i do this.
Kindly advice me,
Thanks

So i used some of the helper functions on the ionic 2 documentation for sildes.
The (ionSlideDidChange)="slideChanged()" handles the slides autoplay, so when the slide reaches 3 which is your maximum, i stop the autoplay using this.slides.stopAutoplay();.
The html is as:-
<ion-slides autoplay="5000" loop="true" speed="500" pager="true" (ionSlideDidChange)="slideChanged()">
<ion-slide class="slider1">
<h1>My <span>Neighbours</span></h1>
<p>My Neighbours is a directory of people who live in the building and have chosen to</p>
<div class="homepeople">
<div class="home"></div>
<div class="people"></div>
</div>
</ion-slide>
<ion-slide class="slider2">
<h1>CCTV <span>Monitoring</span></h1>
<p>Residents/Managers can view selected CCTV</p>
<div class="iconholder">
<img src="./assets/images/white CCTV Monitoring.svg" alt="Image">
</div>
</ion-slide>
<ion-slide class="slider3">
<h1>Emergency</h1>
<p>Security / Reception / Police / Ambulance / Fire</p>
<div class="iconholder">
<div class="iconholder-blk">
<img src="./assets/images/white emergency icon.svg" alt="Image">
</div>
<div class="iconholder-blk">
<img src="./assets/images/white Alarm.svg" alt="Image">
</div>
</div>
<button ion-button outline small (click)="navHome()">
Start using the app
</button>
</ion-slide>
</ion-slides>
The ts is as:-
export class HomePage {
#ViewChild(Slides) slides: Slides;
constructor() {
}
slideChanged() {
let currentIndex = this.slides.getActiveIndex();
if(currentIndex==3){
this.slides.stopAutoplay();
}
}
Hope this helps.

You can have a configuration for an Ionic Slide
Complete Source: Link
HTML
<ion-slides pager="true" [options]="slideOptsOne" #slideWithNav
(ionSlideDidChange)="SlideDidChange(sliderOne,slideWithNav)">
<ion-slide *ngFor="let s of sliderOne.slidesItems">
<img src="../../assets/images/{{s.id}}.jpg">
</ion-slide>
</ion-slides>
Component
With AutoPlay Set to true
slideOptsOne = {
initialSlide: 0,
slidesPerView: 1,
autoplay:true
};

Related

How to show a detail page of a product with Laravel Livewire

I have a project in Laravel and Livewire.
This is my view displaying a list of projects submitted.
#forelse ($projects as $index => $project)
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<a href="#" wire:click="showProjectDetails({{ $project->slug }})"
class="block p-6 bg-white border border-gray-200 rounded-sm shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700">
<h5 class="mb-2 text-2xl font-bold tracking-tight text-blue-500 dark:text-white">
{{ $project->title }}
</h5>
<p class="my-5">Bugdet Ghc500 - Ghc 700</p>
<p class="font-normal text-gray-700 dark:text-gray-400">{{ $project->description }}</p>
<ul class="flex gap-4 text-blue-600 mt-5">
<li>PHP</li>|
<li>Mobile App Development</li>|
<li>Database Management</li>|
<li>C++</li>
</ul>
</a>
</div>
#empty
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<p class="text-4xl">No Projects found</p>
</div>
#endforelse
When I click on a single project, a new view called show-project should display the details of the particular project that has been clicked.
My Livewire controller
public function showProjectDetails($slug)
{
return redirect()->route('show-project.details', $slug);
}
<a href="{{ route('show.project_details', ['slug' => $project->slug]) }}">
and web.php route can be either Controller or Livewire page.

Parallax Not functioning properly : Django

I have downloaded the template : http://keenthemes.com/preview/megakit/
On the index page there is a parallax :
<div class="js__parallax-window" style="background: url(img/1920x1080/04.jpg) 50% 0 no-repeat fixed;">
<div class="container g-text-center--xs g-padding-y-80--xs g-padding-y-125--sm">
<p class="text-uppercase g-font-size-14--xs g-font-weight--700 g-color--white-opacity g-letter-spacing--2 g-margin-b-50--xs">Testimonials</p>
<div class="s-swiper js__swiper-testimonials">
<!-- Swiper Wrapper -->
<div class="swiper-wrapper g-margin-b-50--xs">
<div class="swiper-slide g-padding-x-130--sm g-padding-x-150--lg">
<div class="g-padding-x-20--xs g-padding-x-50--lg">
<div class="g-margin-b-40--xs">
<p class="g-font-size-22--xs g-font-size-28--sm g-color--white"><i>" I have purchased many great templates over the years but this product and this company have taken it to the next level. Exceptional customizability. "</i></p>
</div>
<div class="center-block g-hor-divider__solid--white-opacity-lightest g-width-100--xs g-margin-b-30--xs"></div>
<h4 class="g-font-size-15--xs g-font-size-18--sm g-color--white-opacity-light g-margin-b-5--xs">Jake Richardson / Google</h4>
</div>
</div>
<div class="swiper-slide g-padding-x-130--sm g-padding-x-150--lg">
<div class="g-padding-x-20--xs g-padding-x-50--lg">
<div class="g-margin-b-40--xs">
<p class="g-font-size-22--xs g-font-size-28--sm g-color--white"><i>" I have purchased many great templates over the years but this product and this company have taken it to the next level. Exceptional customizability. "</i></p>
</div>
<div class="center-block g-hor-divider__solid--white-opacity-lightest g-width-100--xs g-margin-b-30--xs"></div>
<h4 class="g-font-size-15--xs g-font-size-18--sm g-color--white-opacity-light g-margin-b-5--xs">Jake Richardson / Google</h4>
</div>
</div>
<div class="swiper-slide g-padding-x-130--sm g-padding-x-150--lg">
<div class="g-padding-x-20--xs g-padding-x-50--lg">
<div class="g-margin-b-40--xs">
<p class="g-font-size-22--xs g-font-size-28--sm g-color--white"><i>" I have purchased many great templates over the years but this product and this company have taken it to the next level. Exceptional customizability. "</i></p>
</div>
<div class="center-block g-hor-divider__solid--white-opacity-lightest g-width-100--xs g-margin-b-30--xs"></div>
<h4 class="g-font-size-15--xs g-font-size-18--sm g-color--white-opacity-light g-margin-b-5--xs">Jake Richardson / Google</h4>
</div>
</div>
</div>
<!-- End Swipper Wrapper -->
<!-- Arrows -->
<div class="g-font-size-22--xs g-color--white-opacity js__swiper-fraction"></div>
<!-- End Arrows -->
</div>
</div>
</div>
The Parallax image is basically defined with properties in the line :
<div class="js__parallax-window" style="background: url(img/1920x1080/04.jpg) 50% 0 no-repeat fixed;">
Now to use the same in django I changed the url of the image to following:
<div class="js__parallax-window" style="background: url({% static 'img_events/1920x1080/04.jpg' %}) 50% 0 no-repeat fixed;" >
The only problem the parallax is not working properly in this case, the parallax image size should only be 50% but it causes a mismatch in the height and placement of the testimonials and the background image whereas the same code works in the template
The only problem here was that <!DOCTYPE html> was not included at the beginning of the page.

github pages missing path

In my github repo exists a folder within the pathway "TriviaGame/assets/images/" but on the io page of that repo, the pathway to the file produces a "404". It seems that github pages is not uploading the image. ["TriviaGame/assets/images/backgroundimage.png"][1]
TriviaGame/assets/images/backgroundImage.png
https://dboothy.github.io/TriviaGame/assets/images/backgroundimage.png
Failed to load resource: the server responded with a status of 404 ()
dboothy.github.io/:1 GET https://dboothy.github.io/TriviaGame/assets/images/backgroundimage.png 404
404 error on io
[1]:
.content-wrap {
background: url("../images/backgroundimage.png") no-repeat center fixed;
background-size: cover;
min-height: 100vh;
}
<div class="content-wrap" align="center">
<div id="heading" class="hide">
<h2>Time remaining: <span id="timer"></span></h2>
</div>
<div class= "container">
<div id = "game-wrapper">
<div id="main-content">
<div class="content-container">
<h1>Movie Trivia</h1>
<div id="welcome">
<p>try and answer as many question in the time allowed</p>
<div id="results" class="hide"></div>
<button id="startGame" class="textBox">Start</button>
</div>
<div id="gameWrap" class="hide">
<div id="questionWrap"></div>
<button id="finish" class="btn btn-warning">FINISH</button>
</div>
</div>
</div>
</div>
</div>
</div>
https://i.stack.imgur.com/R7kG8.png
In css above I typed:
"../images/backgroundimage.png"
when actually file was named "../images/backgroundImage.png"

Bootstrap Datepicker goes bottom

I am not an expert in Bootstrap 3. It was my first time to use the widget "datepicker". I have two date pickers that need to be displayed inline to each other. When I try a normal input it works but if it is a date picker it goes a little far at the bottom. I tried the position relative however it did not resolve the issue. See screen shot attached.Date picker goes at the bottom
Hope some one can give me some light. Below is my code.`
<div class="horiz-search-bar-wrapper">
<form class="form-inline">
<div class="form-group">
<label><strong>Search</strong></label>
</div>
<div class="input-daterange">
<div class="form-group rel-position-date">
<label>Check-In:</label>
<div class="input-group input-append date" id="from">
<input type="text" class="form-control">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
</div>
<div class="form-group rel-position-date">
<label>Check-Out</label>
<div class="input-group input-append date" id="to">
<input type="text" class="form-control">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group mar-left">
<button type="button" class="btn btn-primary">
Submit
</button>
</div>
</form>
</div>
`
Just an update to this, we were able to fixed the issue by replacing the <label></label> tag to <span></span>. The bootstrap datepicker adds top pixels when it sees more than 1 label.
Hope this could help the others.
I was also seeing issues with the Datepicker appearing too low. Whether the targeted element was toward the top or bottom of the viewport and the Datepicker was respectively orienting itself above or below the element, I was seeing a Datepicker appear "too-low."
Stumbled on to a fix with some JavaScript hackery bound to the DP's "show" event/hook.
Note the use of the native Boostrap CSS utility classes datepicker-orient-top and datepicker-orient-bottom.
$('#DateOfBirthForEditing').datepicker().on("show", function (e) {
var refDatePicker = $('div.datepicker.datepicker-dropdown');
var refDatePickerField = $('#DateOfBirthForEditing');
var fieldPositionTop = refDatePickerField.offset().top;
var dpModalTopOffset = 0;
if (refDatePicker.hasClass('datepicker-orient-top')) {
dpModalTopOffset = fieldPositionTop - 255;
} else if (refDatePicker.hasClass('datepicker-orient-bottom')) {
dpModalTopOffset = fieldPositionTop + 30;
}
refDatePicker.css({ "top": dpModalTopOffset });
});

How to add tooltip on input field by using zurb foundation

I want to add a tooltip at bottom of input area.
So I wrote like this.
<div class="row collapse">
<div class="small-9 columns">
<span data-tooltip class="has-tip" title="Tooltip">
<input type="text" placeholder="name">
</span>
</div>
<div class="small-3 columns">
Action
</div>
</div>
But tooltip is appeared not at bottom of input field, but over the field.
How can I show tooltip bottom of input area correctly?
Try
<div class="row collapse">
<div class="small-9 columns">
<input type="text" placeholder="name" data-tooltip class="has-tip" title="Tooltip">
</div>
<div class="small-3 columns">
Action
</div>
</div>
Or you could place the tip in the <div class="small-9 columns">
This java-script gives the same effect as foundation5 tooltip, but for form elments without using the tooltip plugin.
HTML Code:
<input type="text" placeholder="name" data-tooltip title="This is the tip" />
Javascript:
inputToolTip: function() {
var _fadeSpeed = 400;
$("input[data-tooltip],textarea[data-tooltip]").each(function(k, input) {
var $input = $(input);
var _tiptext = $input.attr('title');
console.log($input);
var $tip = $('<div class="tip-place"><span class="tooltip tip-bottom tip-me">' +
_tiptext + '<span class="nub"></span></span></div>').hide();
$input.after($tip);
$input.focus(function() {
$tip.fadeIn(_fadeSpeed);
$input.attr('title','');
}).blur(function() {
$input.attr('title',_tiptext);
$tip.fadeOut(_fadeSpeed);
});
$input.removeAttr('data-tooltip');
})
};
inputToolTip(); // You will need to call this again, after adding a form via ajax, etc.
And finally some CSS Code
.tooltip.tip-me {
left: 1em
display: block
top: -1em
position: relative
}
.tip-place {
height: 0
}