IOS loading failure on large (more than 50) images using swiper - swiper.js

trying to build a website with swiper with bigger number of photos.
On various browsers on Mac and PC it works well, but fail on ios safari after more than 50 images are within my images array.
Failure is that IOS Safari try to load the page, refreshes automatically and try again and again, then show a message saying that website loading failed.
Same on IOS Firefox works.
The source I build up using some PHP within a CMS (LEPTON), after collection the image names (without size & extension) within an array:
foreach( $aImages as $image )
{
$div .= ' <div class="swiper-slide" data-title="' . $image . '" >' . PHP_EOL;
$div .= ' <img data-src="' . $imageURL . $image . '_8b.png" data-srcset="' . $imageURL . $image . '_24b.png 1200w" class="swiper-lazy">' . PHP_EOL;
$div .= ' <div class="swiper-lazy-preloader"></div>' . PHP_EOL;
$div .= ' </div>' . PHP_EOL;
}
my JS to initialize the slider looks like:
$(document).ready(function () {
//initialize swiper when document ready
var mySwiper = new Swiper ('.swiper-container', {
/* parameters with different value than default */
// Duration of transition between slides (in ms)
speed: 1400,
// fading effect
effect: 'fade',
fadeEffect: {
crossFade: true
},
// show hand on image
grabCursor: true,
// add visibility class to currently showing image
watchSlidesProgress: true,
watchSlidesVisibility: true,
// Lazy Loading
preloadImages: false,
lazy: {
loadPrevNext: true,
loadPrevNextAmount: 1,
loadOnTransitionStart: true,
},
// continuous loop mode
loop: true,
// double click zoom into image
zoom: false,
// enable keyboard navigation prev/next
keyboard: {
enabled: true,
onlyInViewport: true,
pageUpDown: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
hideOnClick: false,
},
// center image
centeredSlides: true,
centeredSlidesBounds: false,
// autoplay
autoplay: {
delay: 3000,
disableOnInteraction: true
},
autoplay: false,
});
Any idea what's wrong or what I can change in order to solve my issue ?
Thx in advance

I think the solution for my problem are the virtual slides ....
Testing this but getting other issues there ....
And the available examples in native JS does not really help.
Update: Finally I got it running with virtual slides.
However there is a bug within combination with fadings.
Without fade parameter it is running.

Related

Barba.js Transitions No error in console. Transition still not running how do I fix this?

So I started playing around with Barba the other day, I successfully made a sample project with the same out line Im using now except on this project the transition would start on my second page with the third page to slide in. This is not working.
These are the steps I did :
CDN and js page tags at the bottom
wrapped my text in the barba wrappers
3.slide-in & keyframes animation on the css
Initialize the dom
inserted JS code
No errors are being thrown in the console but no transition is working here is my code
network page (2)
<div class="Page2">
<h1>Welcome to the Networking </h1>
About
BACK HOME
</div>
</div>
**Page 1 is Exactly the same , both pages share the same CSS page and JS page and all reside in the same folder.
My CSS reads like this :
.slide-in{
animation: slide-in 0.5s ease forwards;
}
#keyframes slide-in{
from{
transform: translateX(100%);
visibility: visible;
}
to{
transform: translateX(0%);
}
}
My javascript is as follows:
(function(Barba, $){
document.addEventListener("DOMContentLoaded", function(event) {
console.log('pjax start');
Barba.Pjax.start();
Barba.Prefetch.init();
var FadeTransition = Barba.BaseTransition.extend({
start: function() {
/**
This function is automatically called as soon the Transition starts
this.newContainerLoading is a Promise for the loading of the new container
(Barba.js also comes with an handy Promise polyfill!)
*/
// As soon the loading is finished and the old page is faded out, let's fade the new page
Promise
.all([this.newContainerLoading, this.fadeOut()])
.then(this.fadeIn.bind(this));
},
fadeOut: function() {},
fadeIn: function(){
this.newContainer.classList.add("slide-in");
var that = this;
this.newContainer.addEventListener("animationend", function(){
that.newContainer.classList.remove("slide-in");
that.done();
});
}
});
});
Barba.Pjax.getTransition = function () {
return FadeTransition;
};
});

testCafe slowing the tests down after fileUpload

I am automating a data capture form.
The first element of this form is an image file upload control & I'm uploading a 5KB image.
But after this step, the test executes the next step which is writing a text into a textbox & then it halts for nearly 30 seconds.
How to reduce this un-necessary wait?
test('Test 1', async t => {
await listingPage.uploadImage();
await listingPage.listAnItem();
..
Upload image code
async uploadImage() {
await t.setFilesToUpload(this.imageInput, ['../../uploads/photo02.jpg']);
}
** Data entry code block **
async listAnItem() {
await t
.typeText(Selector('#description'), this.DESCRIPTION) /* --> Application is slowing after this step */
.click(this.categorySelect)
.click(Selector('#react-select-2-option-0-0'))
.testcaferc.json file
{
"browsers": [ "chrome", "safari" ],
"remoteChromeVersion": "80",
"src": "specs",
"reporter": [
{
"name": "spec"
}
],
"speed": 1,
"debugOnFail": false,
"skipJsErrors": true,
"selectorTimeout": 20000,
"assertionTimeout": 20000,
"pageLoadTimeout": 8000
}
DOM Snippet of file-upload
<input aria-describedby="error__images" aria-label="Upload an image" tabindex="0" type="file" multiple="" accept="image/jpeg, image/png" data-testid="imageInput" class="ImageInputstyles__Input-sc-2l692w-7 aosWu">
The issue itself was not due to the Upload files control.
Issue was occuring, due to a drop-box, (after uploading file), which was dynamically updating another drop-box that had values populated dynamically based on the value selected in the first drop-down.
Rewriting the drop-down operation something like below resolved the issue:
async fillSubCategoryFields(catType = 'CAT_NAME') {
await t
.click(this.categorySelect, { timeout: 50 })
.click(Selector('.listingSelect__option').withText(catType));
}

iscroll: image carousel like App Store

We are working on a mobile web application. The designer likes the image carousel effect on App Store (the screenshots of the an App). So we try to mimic the same effect using JavaScript.
We are using iScroll to implement. So here is a customization of its demo carousel: http://jsfiddle.net/0t9savgj/. The options are:
{
scrollX: true,
scrollY: false,
momentum: false,
snap: true,
snapSpeed: 400,
keyBindings: true,
indicators: {
el: document.getElementById('indicator'),
resize: false
}
});
The problem is: for the last image, there is always some extra space, which is unwanted:
Does any one knows how to solve this? Or some other JS libraries implementing the same carousel? Thanks.
After exploration, the only way is to use the scroll event of iscroll-probe.js. Manually stop the scrolling when reaching the right border. But the indicators are not exact.

Event SelectField Sencha Touch 2.1 and Using Store and Model in it. (in Sencha Architect 2)

I begin learn about Sencha Touch 2. So, I have had many problems to ask! ^^ Let's research it.
Now I have a data json like:
{
result: "SUCCESS",
national: [
"Afghanistan",
"Albania",
"Albania",
"Algeria",
"American Samoa",
"Andorra"
]
}
Then, I will load it from url: nation.php file.
How can i load it to My Select Field.??????
Share and Support to me.! Thanks :).
I don't know how to do this in Sencha Architect 2 ( i am not using it).. but still
Instead of asking question without try (I mean you didn't post tried code here), Better you start with Sencha Touch Documentation.
Anyway, you can do it as follows
Model
Ext.define('AppName.model.countries', {
extend : 'Ext.data.Model',
config: {
fields: [
{name: 'name', convert: function(value, record) {
return record.raw;
}}
],
}
});
Store
var myStore = Ext.create("Ext.data.ArrayStore", {
model : 'AppName.model.countries',
proxy: {
type: "ajax",
url : "nation.php",
reader: {
type: 'json',
rootProperty : function(data) {
return data.national;
}
}
},
autoLoad: true
});
Select Field in View
Ext.create('Ext.form.Panel', {
fullscreen: true,
items: [{
xtype: 'selectfield',
store: myStore ,
valueField:'name',
displayField:'name'
}]
});
With Viswa's Support. :) I found this problem - XMLHttpRequest cannot load. Origin is not allowed by Access-Control-Allow-Origin error (browser policy security).
And Sencha Touch document say: " The JsonP proxy is useful when you need to load data from a domain other than the one your application is running on. If your application is running on http://domainA.com it cannot use Ajax to load its data from http://domainB.com because cross-domain ajax requests are prohibited by the browser.
" Also, All we need to do is - "Implement all api in Your Webserver" and Follow JsonP's format code: ( in PHP)
$callback = $_REQUEST['callback'];// check callbackkey
// Create the output object.
$output = array('a' => 'Apple', 'b' => 'Banana');// output data.
//start output
if ($callback) {
header('Content-Type: text/javascript');
echo $callback . '(' . json_encode($output) . ');';
} else {
header('Content-Type: application/x-json');
echo json_encode($output);
}
If. Using Sencha Touch 2.1, You can use:
Ext.data.JsonP.request({
url: 'http://otherdomain/svn_visaapi/trunk/api/visa_api.php/test_json',
callbackKey: 'callback',
success: function(result) {
console.log(result);
//Your success function here...
}
});
- If, Using Sencha Architect, you can use a Store.proxy.JsonP to call api.
- Read more document Sencha Touch 2.1 to see that.

dojo DataGrid is not getting next page when scrolling

Here is my code:
<script>
require(["dojox/grid/DataGrid", "dojo/store/Memory","dojo/data/ObjectStore", "dojo/store/JsonRest", "dojo/_base/xhr", "dojo/domReady!"],
function(DataGrid, Memory, ObjectStore, JsonRest, xhr){
var gridSimple,
store,
dataStore;
function createGrid(){
gridSimple = new DataGrid({
store: dataStore,
structure: [
{ name: "Name", field: "name", width: "84px" },
{ name: "Last name", field: "lastName", width: "84px" },
{ name: "e-mail", field: "email", width: "120px" }
],
rowsPerPage: 20,
autoHeight:15,
selectionMode: "single"
}, "grid");
gridSimple.startup();
}
function init(){
store = new JsonRest({target: "/users/"});
dataStore = ObjectStore({objectStore: store});
createGrid();
}
init();
});
</script>
<div id="grid">
</div>
I'm getting the first page (The Range header is being sent), but when scrolling down nothing happens, dojo is not sending the next request. Not sure what I'm doing wrong.
I'm on firefox 14.0.1, btw the scroll is really really slow using the mouse wheel. I also tried in chrome, not getting next page, but at least the mouse wheel works just fine.
Dojo version: 1.7.2
The problem was I had to add the next header to my response:
response.addHeader("Content-Range", "items " + from + "-" + to + "/" + total);
I did not know this. It is what they call the "REST Paging standard". http://dojotoolkit.org/reference-guide/1.7/dojo/store/JsonRest.html#id7
On the other hand, firefox is scrolling painfully slow. Not happening in chrome.
Here is the bug report:
http://bugs.dojotoolkit.org/ticket/15487
So, in firefox preferences>Advanced> uncheck "Use smooth scrolling".