How to use jquery cycle 2 continuous slider but more than one image? - jquery-cycle2

I am using jquery cycle 2 to get a continuous slideshow effect...http://jquery.malsup.com/cycle2/demo/continuous.php
Here is code:
<div class="cycle-slideshow cycle-autoinit"
data-cycle-fx="scrollHorz"
data-cycle-slides="> div"
data-cycle-speed="3000"
data-cycle-pause-on-hover="true"
data-cycle-timeout="1"
data-cycle-easing="linear"
data-cycle-carousel-visible=5>
<div>
<a href="#slide.Link" target="_blank">
<img src="#Url.Content("~/content/cms/slideshow/")#slide.ImageName" alt="" /></a>
</div>
<div>
<a href="#slide.Link" target="_blank">
<img src="#Url.Content("~/content/cms/slideshow/")#slide.ImageName" alt="" /></a>
</div>
</div>
This works. However only one image slides across the screen and then the next appears. What i want is all images slides across next to each other so like 5 are appearing and going round on a rotation?

Hi I think you have to set your data-cycle-fx=carousel.
Try this:
<div class="cycle-slideshow cycle-autoinit"
data-cycle-fx="carousel"
data-cycle-slides="> div"
data-cycle-speed="3000"
data-cycle-pause-on-hover="true"
data-cycle-timeout="1"
data-cycle-easing="linear"
data-cycle-carousel-visible=5>
...
I can't test it now but I hope it works.
Cycle2's carousel transition plugin must be included in order to use the carousel effect.

Here is an example of what you want if it helps: http://jsfiddle.net/CersX/2/
I basically added data-cycle-carousel-fluid=true data-cycle-easing="linear" to there example.
Just swap out the images for yours.
I based my code from http://codepen.io/colir/pen/bhcAx

Here's the answer -
carousel-slide-dimension on Jquery Cycle2 -fixed width/height
'carouselSlideDimension' as your argument or:
data-cycle-carousel-slide-dimension=ANUMBER
$this.cycle({
"allowWrap" : false,
"carouselSlideDimension" : "151px",
"carouselVisible" : 3,
"fx" : "carousel",
"log" : false,
"timeout" : 0,
"next" : "#" + id + " .next",
"prev" : "#" + id + " .prev",
"slideActiveClass" : "active",
"slides" : "> .slide",
});

Related

tap:AMP.setState not working intermittently

tap:AMP.setState not working at times but it works when i reload the page.
<div class="padTop20">
<a [class]="model.nextStep.expand ? 'hide' : 'show'" role="button" class="show" on="tap:AMP.setState({model:{nextStep:{expand: true}}})" id="showmore">Show more</a>
<a [class]="model.nextStep.expand ? 'show' : 'hide'" role="button" class="hide" on="tap:AMP.setState({model:{nextStep:{expand: false}}})" id="showless">Show less</a>
</div>
Here's my default state:
<amp-state id="model">
<script type="application/json">
{
"nextStep":{
"expand":false
}
}
</script>
</amp-state>
Is it something because of network that makes it behave like this?? Appreciate for any help! thanks!
You should try;
[class]="(model.nextStep.expand == 'true') ? 'hide' : 'show'"
and
[class]="(model.nextStep.expand == 'false') ? 'show' : 'hide'"
On page load, as soon as the DOM is loaded, your initial state (false) is fired and [class] is rendered because of amp-bind.
You didn't post much in terms of any console errors or validation errors you might be facing with AMP (which will affect the functionality if you did something weird/wrong)

Centering text inside a div column

I am using the Zurb Foundation framework and am trying to center text.
If I just use the .text-center class:
<h1 class="text-center">My Heading</h1> The text is center.
However, when I place it inside a column, the text is moved slightly to the right:
<div class="row">
<div class="small-2 small-centered columns text-center">
<h1>My Heading</h1>
</div>
</div>
I want to ask what is the correct way of centering the text inside columns?
its should work fine with your code , but if you can provide screenshot to see what do u mean by its move to the right will be nice.
anyway check this solution may work , and the issue could be from additional custom css added if u have one .
CSS :
.row h1 { margin: 0 auto; padding : 0px }
Try this Fiddle
The problem was that the word inside the heading is too long for my mobile device so I added the style property:
word-wrap: break-word;
Not sure if this is the correct way to handle such cases but it is a possible solution.

Foundation Slider does not update input

On this page there is a slider updating a input box with example HTML code. You can also see that same code in the source.
I would like to use this in my application so I transplanted it into my code and converted it to Jade (aka Pug). The source now looks like:
div.row
div.small-10.columns
div.range-slider(data-slider data-options="display_selector: #days-off-count; initial: 28;")
span.range-slider-handle(role="slider" tabindex="0")
span.range-slider-active-segment
div.small-2.columns
input(type="number" id="days-off-count" value="28")
And the resulting html looks like this (after prettifying it):
<div class="row">
<div class="small-10 columns">
<div data-slider data-options="display_selector: #days-off-count; initial: 28;" class="range-slider">
<span role="slider" tabindex="0" class="range-slider-handle"></span>
<span class="range-slider-active-segment"></span>
</div>
</div>
<div class="small-2 columns">
<input type="number" id="days-off-count" value="28">
</div>
</div>
Which is very close that shown on in the docs. However on the resulting page the input box is not updated. If I change the input box to a span like in the
'With Label' example it updates.
span(id="days-off-count" value="28")
becomes
<span id="days-off-count" value="28"></span>
I have the foundation.js and the .slider.js included at the bottom of the page.
In addition, if I manually change the value of the input box via the keyboard the slider will jump to that position, so there is some sort of link there.
The software being used:
Ubuntu 14_04
Chrome
Node v0.10.25
Express 4.14.0
Jade 1.11.0
Foundation v5.5.0
Other things to note:
The page has more than one slider so any javascript solutions need to take this into account.
I think this is a bug (hasOwnProperty instead of hasAttribute #6221) in the version of Foundation (5.5.0) you're using. It seems that while it initially applied only to Firefox, it now applies to Chrome too.
Example with (broken) sliders from 5.5.0: jsfiddle.net/tymothytym/jth99pkw/3
Example with (working) sliders from 5.5.3: jsfiddle.net/tymothytym/tw1we8fk/3
The bug was fixed here: https://github.com/zurb/foundation-sites/commit/896e81f1275eefbbdb84ce4da9004ab059b26d45
Basically, go to foundation.slider.js and change this (line 157):
if (settings.display_selector != '') {
$(settings.display_selector).each(function(){
if (this.hasOwnProperty('value')) { // this is the mistake / bug
$(this).val(value);
} else {
$(this).text(value);
}
});
}
to this:
if (settings.display_selector != '') {
$(settings.display_selector).each(function(){
if (this.hasAttribute('value')) { // this should fix it
$(this).val(value);
} else {
$(this).text(value);
}
});
}
This is not my fix, it's the same as the patch, but it should mean that when you do upgrade you don't need to modify your application code to account for a workaround.
1) Maybe I be wrong... but you didn't specify the version, you give an example from Foundation v5... are you not have installed Foundation v6?
Try this example : https://foundation.zurb.com/sites/docs/slider.html
2) After you include your js files, you need to have this:
<script>
$(document).foundation();
</script>
Edit: Sorry, first time I didn't read all, maybe the problem is that the Foundation use the "value" attribute, which is an attribute designed for <input> tags:
value <button>, <input>, <li>, <option>, <meter>, <progress>, <param> Specifies the value of the element
Source: https://www.w3schools.com/tags/ref_attributes.asp

Zurb foundation more than one joyride

Is it possible to have two joyrides on one page? For example: run one joyride, then, once the user selects something, start a second joyride?
I believe what your looking for has its roots in the answer to this question. You can use the Callback to then initialize a 2nd Joyride by doing something such as triggering a button click on a hidden button.
I haven't been able to test this code yet, but it should work something along these lines:
// set up the config for a Callback
var config = {
nubPosition : 'auto',
postRideCallback : function() {
// Joyride has ended, simulate a click on a hidden button
$(#hidden_button).click();
}
// When the Hidden button is clicked, call the 2nd Joyride
$( "#hidden_button" ).click(function() {
$(document).foundation('joyride2', 'start');
});
You just have to wrap your joyride in a div and then start that joyride when you want to.
For example:
<div id="Joyryde1">
<ol class="joyride-list" data-joyride >
<li data-id="message1" data-text="Next" data-options="tip_location: top">
<p>Joyride 01</p>
</li>
</ol>
</div>
<div id="Joyryde2">
<ol class="joyride-list" data-joyride >
<li data-id="message1" data-text="Next" data-options="tip_location: top">
<p>Joyride 02</p>
</li>
</ol>
</div>
<script>
$("#joyride1").foundation('joyride', 'start'); //Start when the page loads
// Add this to your trigger(button or another page load)
$("#joyride2").foundation('joyride', 'start');
</script>

how to get the list of values using list<> and session in asp.net mvc2

Hi I have a list of values contains different types of prices for the plans..
<div id="rs360">
<span class="font18">Rs.360</span> <span class="font20"></span>
</div>
<th width="20%" class="bdrL_blue valignT highlight">
<img src="../../Content/Images/Subscribe now on click.png" class="btn" onclick="return sms_confirm()"/>
<div id="rs1000">
<span class="font18">Rs.1000</span> <span class="font20"></span>
</div>
// the same button event...
when i click the button it should take the value of prices 360 ,1000.. then it redirects to the another page. on that page i click some payment options. so it should show which amount i select here like that...
i don't know what is the best way to do this? please give some ideas to do that?
So you want transfer the values 360, 1000... to your payment page?
[HttpPost]
public ActionResult YourActionName(double? price)
{
Session("PickedPrice")=price;
}
then your button event is call the controller with your value is price, for ex :
$.post("Controller/YourActionName",{ price : value_of_your_price });
In your payment's page you can use it by using Session("PickedPrice"), when you done, reset Session("PickedPrice").
This is my solution, it's may not the best way and I just newbie but I want to help you. Try!