Skip to content

Commit 28ee99b

Browse files
committed
- Improving jshint validation
1 parent 5973175 commit 28ee99b

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

jquery.fullPage.js

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -269,35 +269,35 @@
269269
$htmlBody.scrollTop(element.position().top);
270270
}
271271
}
272-
};
272+
}
273273

274274
/**
275275
* Defines wheter to record the history for each hash change in the URL.
276276
*/
277277
function setRecordHistory(value, type){
278278
setVariableState('recordHistory', value, type);
279-
};
279+
}
280280

281281
/**
282282
* Defines the scrolling speed
283283
*/
284284
function setScrollingSpeed(value, type){
285285
setVariableState('scrollingSpeed', value, type);
286-
};
286+
}
287287

288288
/**
289289
* Sets fitToSection
290290
*/
291291
function setFitToSection(value, type){
292292
setVariableState('fitToSection', value, type);
293-
};
293+
}
294294

295295
/**
296296
* Sets lockAnchors
297297
*/
298298
function setLockAnchors(value){
299299
options.lockAnchors = value;
300-
};
300+
}
301301

302302
/**
303303
* Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad.
@@ -310,7 +310,7 @@
310310
removeMouseWheelHandler();
311311
removeMiddleWheelHandler();
312312
}
313-
};
313+
}
314314

315315
/**
316316
* Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures.
@@ -333,7 +333,7 @@
333333
setMouseWheelScrolling(false);
334334
removeTouchHandler();
335335
}
336-
};
336+
}
337337

338338
/**
339339
* Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys
@@ -348,7 +348,7 @@
348348
}else{
349349
options.keyboardScrolling = value;
350350
}
351-
};
351+
}
352352

353353
/**
354354
* Moves the page up one section.
@@ -364,7 +364,7 @@
364364
if (prev.length) {
365365
scrollPage(prev, null, true);
366366
}
367-
};
367+
}
368368

369369
/**
370370
* Moves the page down one section.
@@ -381,7 +381,7 @@
381381
if(next.length){
382382
scrollPage(next, null, false);
383383
}
384-
};
384+
}
385385

386386
/**
387387
* Moves the page to the given section and slide with no animation.
@@ -391,7 +391,7 @@
391391
setScrollingSpeed (0, 'internal');
392392
moveTo(sectionAnchor, slideAnchor);
393393
setScrollingSpeed (originals.scrollingSpeed, 'internal');
394-
};
394+
}
395395

396396
/**
397397
* Moves the page to the given section and slide.
@@ -405,23 +405,23 @@
405405
}else if(destiny.length > 0){
406406
scrollPage(destiny);
407407
}
408-
};
408+
}
409409

410410
/**
411411
* Slides right the slider of the active section.
412412
* Optional `section` param.
413413
*/
414414
function moveSlideRight(section){
415415
moveSlide('right', section);
416-
};
416+
}
417417

418418
/**
419419
* Slides left the slider of the active section.
420420
* Optional `section` param.
421421
*/
422422
function moveSlideLeft(section){
423423
moveSlide('left', section);
424-
};
424+
}
425425

426426
/**
427427
* When resizing is finished, we adjust the slides sizes and positions
@@ -473,7 +473,7 @@
473473
isResizing = false;
474474
$.isFunction( options.afterResize ) && resizing && options.afterResize.call(container);
475475
$.isFunction( options.afterReBuild ) && !resizing && options.afterReBuild.call(container);
476-
};
476+
}
477477

478478
/**
479479
* Turns fullPage.js to normal scrolling mode when the viewport `width` or `height`
@@ -498,7 +498,7 @@
498498
$body.removeClass(RESPONSIVE);
499499
$.isFunction( options.afterResponsive ) && options.afterResponsive.call( container, active);
500500
}
501-
};
501+
}
502502

503503
function getFullpageData(){
504504
return {
@@ -516,7 +516,7 @@
516516
styleSlides: styleSlides
517517
}
518518
};
519-
};
519+
}
520520

521521
if($(this).length){
522522
//public functions
@@ -974,10 +974,12 @@
974974
var anchorLink = currentSection.data('anchor');
975975
var sectionIndex = currentSection.index(SECTION_SEL) + 1;
976976
var activeSlide = currentSection.find(SLIDE_ACTIVE_SEL);
977+
var slideIndex;
978+
var slideAnchorLink;
977979

978980
if(activeSlide.length){
979-
var slideAnchorLink = activeSlide.data('anchor');
980-
var slideIndex = activeSlide.index();
981+
slideAnchorLink = activeSlide.data('anchor');
982+
slideIndex = activeSlide.index();
981983
}
982984

983985
if(canScroll){
@@ -1380,6 +1382,8 @@
13801382
if(typeof element === 'undefined'){ return; } //there's no element to scroll, leaving the function
13811383

13821384
var dtop = getDestinationPosition(element);
1385+
var slideAnchorLink;
1386+
var slideIndex;
13831387

13841388
//local variables
13851389
var v = {
@@ -1403,8 +1407,8 @@
14031407
if((v.activeSection.is(element) && !isResizing) || (options.scrollBar && $window.scrollTop() === v.dtop && !element.hasClass(AUTO_HEIGHT) )){ return; }
14041408

14051409
if(v.activeSlide.length){
1406-
var slideAnchorLink = v.activeSlide.data('anchor');
1407-
var slideIndex = v.activeSlide.index();
1410+
slideAnchorLink = v.activeSlide.data('anchor');
1411+
slideIndex = v.activeSlide.index();
14081412
}
14091413

14101414
// If continuousVertical && we need to wrap around
@@ -1583,9 +1587,9 @@
15831587
* Lazy loads image, video and audio elements.
15841588
*/
15851589
function lazyLoad(destiny){
1586-
var destiny = getSlideOrSection(destiny);
1590+
var panel = getSlideOrSection(destiny);
15871591

1588-
destiny.find('img[data-src], source[data-src], audio[data-src], iframe[data-src]').each(function(){
1592+
panel.find('img[data-src], source[data-src], audio[data-src], iframe[data-src]').each(function(){
15891593
$(this).attr('src', $(this).data('src'));
15901594
$(this).removeAttr('data-src');
15911595

@@ -1599,10 +1603,10 @@
15991603
* Plays video and audio elements.
16001604
*/
16011605
function playMedia(destiny){
1602-
var destiny = getSlideOrSection(destiny);
1606+
var panel = getSlideOrSection(destiny);
16031607

16041608
//playing HTML5 media elements
1605-
destiny.find('video, audio').each(function(){
1609+
panel.find('video, audio').each(function(){
16061610
var element = $(this).get(0);
16071611

16081612
if( element.hasAttribute('data-autoplay') && typeof element.play === 'function' ) {
@@ -1611,7 +1615,7 @@
16111615
});
16121616

16131617
//youtube videos
1614-
destiny.find('iframe[src*="youtube.com/embed/"]').each(function(){
1618+
panel.find('iframe[src*="youtube.com/embed/"]').each(function(){
16151619
var element = $(this).get(0);
16161620

16171621
if ( element.hasAttribute('data-autoplay') ){
@@ -1632,16 +1636,16 @@
16321636
*/
16331637
function playYoutube(element){
16341638
element.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
1635-
};
1639+
}
16361640

16371641
/**
16381642
* Stops video and audio elements.
16391643
*/
16401644
function stopMedia(destiny){
1641-
var destiny = getSlideOrSection(destiny);
1645+
var panel = getSlideOrSection(destiny);
16421646

16431647
//stopping HTML5 media elements
1644-
destiny.find('video, audio').each(function(){
1648+
panel.find('video, audio').each(function(){
16451649
var element = $(this).get(0);
16461650

16471651
if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {
@@ -1650,7 +1654,7 @@
16501654
});
16511655

16521656
//youtube videos
1653-
destiny.find('iframe[src*="youtube.com/embed/"]').each(function(){
1657+
panel.find('iframe[src*="youtube.com/embed/"]').each(function(){
16541658
var element = $(this).get(0);
16551659

16561660
if( /youtube\.com\/embed\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){
@@ -1827,6 +1831,7 @@
18271831
moveSectionUp();
18281832
break;
18291833
}
1834+
/* falls through */
18301835
case 40:
18311836
case 34:
18321837
if(isScrollAllowed.k.down){
@@ -2694,7 +2699,7 @@
26942699
if(all){
26952700
destroyStructure();
26962701
}
2697-
};
2702+
}
26982703

26992704
/*
27002705
* Removes inline styles added by fullpage.js

0 commit comments

Comments
 (0)