-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3dsjq.js
1540 lines (1076 loc) · 31.9 KB
/
3dsjq.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Edits 08.04.2015
// 1. Added stereoIsOn - global variable to indicate if the library is running
// 2. Variables definition levelled all over the library
// 3. Fixed issue with multiple ids within a single selector
// Edits 25.05.2015
// 1. Fixed the issue with background stretching for original and clone containers
// 2. Added the _3dsjq_ class to the body
// Edits 09.06.2015
// 1. Stereo content detection stage is added
// 2. isShifted() function added
// 3. addCountClass() function is added
// 4. @media queries is now accounted during styles composition
// 5. getStyles() function is added
// Edits 15.06.2015
// 1. "stereo-content" CSS property recognition for images added
// 2. Removed excessive variables
// Edits 15.07.2015
// 1. Fixed the scrolling mirroring for top-to-bottom method
// 2. All "stereo" related CSS properties are recognized.
// Edits 20.07.2016
// 1. Fixed the styles cloning function
// 2. quit3DS() function is added
// 3. stereoMode flag is added
// Edits 12.11.2018
// 1. Debugging falg added to conversion functions
// Global vars
var protocol = location.protocol,
uA = navigator.userAgent.toLowerCase(),
zPlaneShiftedObjs = [],
inputParams = [],
prefix = "_3dsjq_",
stereoObjArr = [],
hoverElemIDs = [],
initContent,
bodyBack,
bodyMargin,
bodyPadding,
bodyInitHeight,
elemCount, // Counting number of elements in a markup
zPlaneDefaultParams = {
method: 'left-to-right', // side-by-side method (left-to-right, top-to-bottom) string
depthBudget: 1.5, // maximum allowed amount of shifting in % int
levels: 5, // the maximum number of zPlanes int
visualCues: true, // enabling/disabling scaling for zPlanes boolean
scaleAmount: 10, // amount of scaling in %s int
shiftAnim: true, // enabling/disabling animation fot zPlane shifting boolean
shiftAnimDuration: 0.25 // animation duration in seconds int
},
zParams,
shiftLimit,
shiftStep,
shiftScale,
shiftMaxLvl,
initsSA,
winW,
winH,
initDocH,
initHTML,
stereoMode = false;
$.ajaxSetup({ cache: false }); // Prevents caching
// Initialization
function go3DS( objArr, params ) {
winW = $(window).width(),
winH = $(window).height(),
initHTML = $("body").html();
stereoMode = true;
if ( objArr ) {
zPlaneShiftedObjs = objArr;
}
if ( params ) {
inputParams = params;
}
zParams = zPlaneDefaultParams;
// Checking out input params
if ( inputParams ) {
$.each(inputParams, function(param, val){
if ( zParams[param] != val ) {
zParams[param] = val;
}
});
}
cloneContent();
}
// functions.js
// Function to get original container. Returns original container object.
function getOriginalContainer(){
return $("#"+prefix+"original");
}
// Function to get clone container. Returns clone container object.
function getCloneContainer(){
return $("#"+prefix+"original");
}
// Function to get container width
function getStereoContainerWidth() {
var stereoContainerW = $(window).width()/2;
return stereoContainerW;
}
// Function to get the class containing the current depth level
function getLevelClass(target) {
var levelClass = "",
targetClass = target.attr("class"),
classes = targetClass.split(" "),
patt = new RegExp(prefix+"level_", "g");
$.each(classes, function(key, val) {
if ( patt.test(val) ) {
levelClass = val;
}
});
if ( levelClass ) {
return levelClass;
} else {
return 0;
}
}
// buildObjParamArr( ... ) - function to store initial data for elements to be shifted
function buildObjParamArr( target, objID, objPseudo, initLvl, pseudoLvl ) {
target.each(function(){
if ( !$(this).isCalculated() && $(this).isOriginal() ) {
var tML = parseInt($(this).css("margin-left"), 10),
tMR = parseInt($(this).css("margin-right"), 10),
objZID = $(this).getElementID(),
initZInd = parseInt($(this).css("z-index"),10) || 0;
var obj = buildArray(objID, objZID, objPseudo, initLvl, pseudoLvl, tML, tMR, initZInd);
stereoObjArr.push(obj);
}
});
}
// Function to builld array of data for each element for S3D conversion
function buildArray(objID, objZID, objPseudo, initLvl, pseudoLvl, initML, initMR, initZInd) {
return {
objID: objID,
objZID: objZID,
objPseudo: objPseudo,
initLvl: initLvl,
pseudoLvl: pseudoLvl,
initML: initML,
initMR: initMR,
initZInd: initZInd
};
}
// jQuery extensions
(function($){
$.fn.extend({
// getOriginalContainer() - Function to get the parent for the original part. Returns original container object.
getOriginalContainer: function() {
var originalContainer = this.find("#"+prefix+"original");
if ( originalContainer ) {
return originalContainer;
} else {
console.log('getOriginalContainer() failed to find original container within the specified parent.');
return false;
}
},
// getCloneContainer() - Function to get the parent for the clone part. Returns clone container object.
getCloneContainer: function() {
var cloneContainer = this.find("#"+prefix+"clone");
if ( cloneContainer ) {
return cloneContainer;
} else {
console.log('getCloneContainer() failed to find clone container within the specified parent.');
}
},
// getCountClass() - function to extract the class containing elem_ID
getCountClass: function(){
var outputClass = "";
this.each(function(){
var targetClass = $(this).attr("class"),
classes = targetClass.split(" "),
patt = new RegExp(prefix+"elem_ID_", "g");
$.each(classes, function(key, val) {
if ( patt.test(val) ) {
outputClass = val;
}
});
});
return outputClass;
},
// addCountClass() - function to addCountClass to the new elements
addCountClass: function(){
this.each(function(){
var last = $("body").getOriginalContainer().find("*").last().getCountClass(),
patt = new RegExp(prefix+"elem_ID_", "g"),
newCC = parseInt(last.replace(patt, ""))+1;
$(this)
.getBoth()
.addClass(prefix+"elem_ID_"+newCC);
});
},
getStyles: function(){
this.after("<div id='"+prefix+"style_ref'></div>");
var dom = this.get(0),
style,
styleRef,
returns = {},
ref = document.getElementById(""+prefix+"style_ref");
if(window.getComputedStyle){
var camelize = function(a,b){
return b.toUpperCase();
};
style = window.getComputedStyle(dom, null),
styleRef = window.getComputedStyle(ref, null);
for(var i = 0, l = style.length; i < l; i++){
var prop = style[i],
camel = prop.replace(/\-([a-z])/g, camelize),
val = style.getPropertyValue(style[i]),
valRef = styleRef.getPropertyValue(styleRef[i]);
if ( val !== valRef ) { returns[camel] = val; };
};
return returns;
};
if(style = dom.currentStyle){
for(var prop in style){
returns[prop] = style[prop];
};
return returns;
};
ref.remove();
return this.css();
},
// isShifted() - checks if the current element is shifted, returns depth level if the element is shifted;
isShifted: function() {
var isShifted = false;
this.each(function() {
var tCC = $(this).getCountClass();
$.each(zPlaneShiftedObjs, function( elemID, level ){
$("body")
.getOriginalContainer()
.find("" + elemID)
.each(function(){
if ( tCC == $(this).getCountClass() ) {
isShifted = level;
return false;
}
});
});
});
return isShifted;
},
// isCalculated() - checks if the current element params have being calculated and pushed to stereoObjArr;
isCalculated: function() {
var isCalculated = false;
this.each(function() {
var tID = $(this).getElementID();
$.each(stereoObjArr, function(key, arr){
if( arr.objZID == tID ) {
isCalculated = true;
}
});
});
return isCalculated;
},
// isOriginal() - function to check if an element is inside the original container. Returns boolean value;
isOriginal: function(){
var output = false;
this.each(function(){
output = $(this).closest("#"+prefix+"original").length > 0;
});
return output;
},
// isClone() - function to check if an element is inside the clone container. Returns boolean value;
isClone: function(){
var output = false;
this.each(function(){
output = $(this).closest("#"+prefix+"original").length > 0;
});
return output;
},
// getElementID() - function to get elem_ID of the current element
getElementID: function(){
var output;
this.each(function(){
output = $(this).getCountClass().replace(prefix+"elem_ID_", "");
});
return output;
},
// getBoth() - Function to filter both original and clone elements. Returns object with a framework specific class.
getBoth: function() {
var outputClass;
this.each(function() {
outputClass = $(this).getCountClass();
});
return $("." + outputClass);
},
// getClone() - Function to filter the clone element. Returns clone object.
getClone: function() {
this.each(function() {
outputClass = $(this).getCountClass();
});
return $("body").getCloneContainer().find("." + outputClass);
},
// appendBoth() - Function to append elements to both original and clone containers. Returns target object.
appendBoth: function(html) {
var processedHTML,
originalHTML,
cloneHTML,
thisL = this.length,
c = 0;
this.each(function() {
c++;
var thisClass = $(this).getCountClass();
if ( thisL == 1 ) { thisL = 2; }
if ( c <= thisL/2 ) {
processedHTML = processInputHTMLstr(html);
originalHTML = processedHTML[0];
cloneHTML = processedHTML[1];
$("body")
.getOriginalContainer()
.find("." + thisClass)
.append(originalHTML)
.getClone()
.append(cloneHTML);
}
});
return this;
},
// appendBoth() - Function to prepend elements to both original and clone containers. Returns target object.
prependBoth: function(html) {
var processedHTML,
originalHTML,
cloneHTML,
thisL = this.length,
c = 0;
this.each(function() {
c++;
var thisClass = $(this).getCountClass();
if ( thisL == 1 ) { thisL = 2; }
if ( c <= thisL/2 ) {
processedHTML = processInputHTMLstr(html);
originalHTML = processedHTML[0];
cloneHTML = processedHTML[1];
$("body")
.getOriginalContainer()
.find("." + thisClass)
.prepend(originalHTML)
.getClone()
.prepend(cloneHTML);
}
});
return this;
},
// beforeBoth() - Function to inject elements before a target to both original and clone containers. Returns target object.
beforeBoth: function(html) {
var processedHTML,
originalHTML,
cloneHTML,
thisL = this.length,
c = 0;
this.each(function() {
c++;
var thisClass = $(this).getCountClass();
if ( thisL == 1 ) { thisL = 2; }
if ( c <= thisL/2 ) {
processedHTML = processInputHTMLstr(html);
originalHTML = processedHTML[0];
cloneHTML = processedHTML[1];
$("body")
.getOriginalContainer()
.find("." + thisClass)
.before(originalHTML)
.getClone()
.before(cloneHTML);
}
});
return this;
},
// afterBoth() - Function to inject elements after a target to both original and clone containers. Returns target object.
afterBoth: function(html) {
var processedHTML,
originalHTML,
cloneHTML,
thisL = this.length,
c = 0;
this.each(function() {
c++;
var thisClass = $(this).getCountClass();
if ( thisL == 1 ) { thisL = 2; }
if ( c <= thisL/2 ) {
processedHTML = processInputHTMLstr(html);
originalHTML = processedHTML[0];
cloneHTML = processedHTML[1];
$("body")
.getOriginalContainer()
.find("." + thisClass)
.after(originalHTML)
.getClone()
.after(cloneHTML);
}
});
return this;
},
// shift(level) - Function to shift elements in the zPlane. Returns the targeted item.
shift: function(level) {
var output;
this.each(function() {
if ( level !== undefined && $(this).isOriginal() ) {
var targetClass = $(this).attr("class"),
classes = targetClass.split(" "),
oID = $("body").getOriginalContainer().attr("id"),
selector = "#"+oID+" ";
$.each(classes, function(key, val) {
selector = selector+"."+val;
});
var target = $(""+selector);
if ( !$(this).isCalculated() ) {
var initZInd = parseInt($(this).css("z-index"),10) || 0;
buildObjParamArr( target, selector, 0, 0, 0, initZInd );
}
$.each(stereoObjArr, function(key, obj){
if ( obj.objZID == target.getElementID() ) {
var initML = obj.initML,
initMR = obj.initMR,
initZInd = obj.initZInd;
zPlaneShifter(target, level, initML, initMR, initZInd);
}
});
}
});
return this;
},
// getDepthLevel() - Function to get the level of the object. Returns int.
getLevel: function() {
var level;
this.each(function() {
var levelClass = getLevelClass($(this)),
patt = new RegExp(prefix+"level_","g");
if ( levelClass !== 0 ) {
level = parseInt(levelClass.replace(patt, ""), 10);
} else {
level = 0;
}
});
return level;
}
});
})(jQuery);
// Function to process HTML string before insertion into HTML
function processInputHTMLstr( HTMLstr ) {
var originalHTML = HTMLstr,
cloneHTML = HTMLstr,
tags = HTMLstr.match(/<\w.*?>/gm);
$.each( tags, function( i, tag ){
var idAttrs = tag.match(/id=("|').*?("|')/);
if ( idAttrs ) {
$.each( idAttrs, function( x, idAttr ){
if ( /id=/.test(idAttr) ) {
var idStr = idAttr.replace(/id=("|')/,"").replace(/("|')/,""),
outputID = idStr+prefix,
repPatt = new RegExp( "id=(\"|')" + idStr );
cloneHTML = cloneHTML.replace( repPatt, "id='" + outputID );
}
});
}
var classAttrs = tag.match(/class=("|').*?("|')/);
if ( classAttrs ) {
$.each( classAttrs, function( x, classAttr ){
if ( /class=/.test(classAttr) ) {
elemCount++;
var classStr = classAttr.replace(/class=("|')/,"").replace(/("|')/,""),
outputClass = classStr + " " + prefix + "elem_ID_" + elemCount,
repPatt = new RegExp( "class=(\"|')" + classStr );
cloneHTML = cloneHTML.replace( repPatt, "class='" + outputClass );
originalHTML = originalHTML.replace( repPatt, "class='" + outputClass );
}
});
} else {
elemCount++;
cloneHTML = cloneHTML.replace(/>/, " class='" + prefix + "elem_ID_" + elemCount + "'>" );
originalHTML = originalHTML.replace(/>/, " class='" + prefix + "elem_ID_" + elemCount + "'>" );
}
});
return [ originalHTML, cloneHTML ];
}
// cloneContent.js
// Cloning procedures
function cloneContent( debug ) {
console.log("cloning is started");
// Vars
bodyBack = $("body").css("background"),
bodyMargin = $("body").css("margin"),
bodyPadding = $("body").css("padding"),
initContent = $("body").html(),
initDocH = $(document).height(),
bodyInitHeight = $("body").outerHeight();
// Splitting content into original and clone parts and applying styles
$("html")
.css({ height: "100%" })
.find("body")
.css({ height: "100%" })
.wrapInner("<div id='"+prefix+"original' class='"+prefix+"split_part' /></div>");
$("body")
.getOriginalContainer()
.wrapInner("<div class='"+prefix+"container'>");
// Marking all the content inside the Original and attaching specific #ids
elemCount = 0;
$("body").getOriginalContainer().find("."+prefix+"container *").each(function(){
var curClass = "";
if ( $(this).attr("class") ) {
curClass = $(this).attr("class") + " ";
}
$(this).attr("class", curClass + prefix+"elem_ID_"+elemCount);
elemCount++;
});
// Cloning
$("body").getOriginalContainer()
.clone()
.attr("id",prefix+"clone")
.appendTo("body");
elemCount = 0;
$("body").getCloneContainer().find("."+prefix+"container *").each(function(){
var curClass = $(this).attr("class") + " ";
$(this).attr("class", curClass + prefix+"elem_ID_"+elemCount);
elemCount++;
});
// Replacing id attributes inside the clone
$("body").getCloneContainer().find("div [id]").each(function() {
var ID = $(this).attr("id"),
newID = ID+prefix;
$(this).attr("id",newID);
});
var method = inputParams.method;
adjustSideBySide(method);
console.log("cloning is complete");
// Detecting stereo content
if ( !debug ) { detectStereoContent(); }
}
// Stereo content detection
function detectStereoContent( debug ){
console.log("detection of stereo content is started");
// img srcset support
getOriginalContainer()
.find("img")
.each(function(){
var srcset = $(this).attr("srcset");
if ( srcset ) {
if ( / stereo/.test(srcset) ) {
var stereoURL = srcset.replace(/ stereo/, "");
buildStereoContainer( $(this), stereoURL, "img" );
}
}
});
console.log("detection of stereo content is ended");
// Launching styles adaptation
if (!debug){ stylesAdaptation(); }
}
function buildStereoContainer( obj, url, stereoParams ) {
if ( obj.length > 0 ) {
var img = new Image(),
origH = obj.height(),
origW = obj.width(),
origS = obj.getStyles(),
contClass = prefix + "stereo_container",
countClass = obj.getCountClass();
img.src = url;
var imgR = (img.width/2)/img.height;
obj
.getBoth()
.wrap("<div class='"+contClass+" "+countClass+"'></div>")
.hide();
var objCont = obj.parent();
if ( stereoParams ) {
$.each(stereoParams, function(i, param){
var rule = param.replace(/\s|\;/gm,"").split(":"),
prop = rule[0],
val = rule[1];
if ( prop === "stereo-content" && val === "stereo" ) {
objCont
.getBoth()
.css(origS)
.width( origW )
.height( origH*2 )
.css({ backgroundImage: "url('" + url + "')", backgroundSize: origW*2+"px" });
objCont
.getClone()
.css({ backgroundPosition: "right top" });
}
if ( prop === "stereo-render-option" ) {
if ( val === "left" ) { objCont.getClone().css({ background: "none" }); }
else if ( val === "right" ) { objCont.css({ background: "none" }); }
}
if ( prop === "stereo-size-type" && val === "half" ) {
objCont
.getBoth()
.height(origH)
.css({ backgroundSize: "200% 100%" });
}
if ( prop === "stereo-order-type" && val === "rl") {
objCont
.css({ backgroundPosition: "right top" })
.getClone()
.css({ backgroundPosition: "left top" });
}
if ( prop === "stereo-format" && val === "top-bottom" ) {
if ( zParams.method === "left-to-right" ) {
objCont
.getBoth()
.height(origH/2)
.css({ backgroundSize: "100% 200%" });
objCont
.getClone()
.css({ backgroundPosition: "left bottom" });
} else if ( zParams.method === "top-to-bottom" ) {
objCont
.getBoth()
.height(origH/2)
.css({ backgroundSize: "100% 200%" });
objCont
.getClone()
.css({ backgroundPosition: "left bottom" })
}
}
});
}
if ( obj.isShifted() ) {
var lvl = $(this).isShifted();
$(this).shift(lvl);
};
}
}
function adjustSideBySide(method) {
if ( method && method == "top-to-bottom" ) {
margin = (winH/4)*(-1);
$("."+prefix+"split_part").css({
width: "100%",
height: winH/2,
position: "relative"
});
$("."+prefix+"container").css({
width: "100%",
height: winH,
position: "absolute",
top: margin,
"overflow-y": "scroll",
"-webkit-transform": "scaleY(0.5)",
"-moz-transform": "scaleY(0.5)",
"-ms-transform": "scaleY(0.5)",
"transform": "scaleY(0.5)"
});
} else {
$("."+prefix+"split_part").css({
width: "50%",
height: "100%",
float: "left",
"background-size": "100% 100%",
"background-position": "center center",
"background-repeat": "no-repeat",
position: "relative"
});
$("."+prefix+"container").css({
width: "50%",
height: bodyInitHeight,
"-webkit-transform": "scaleX(0.5)",
"-moz-transform": "scaleX(0.5)",
"-ms-transform": "scaleX(0.5)",
"transform": "scaleX(0.5)"
});
if ( $("body").getOriginalContainer().get(0).scrollWidth ) {
if ( $("body").getOriginalContainer().width() >= $("body").getOriginalContainer().get(0).scrollWidth ) {
scrollW = $("body").getOriginalContainer().width() - $("body").getOriginalContainer().get(0).scrollWidth;
} else {
scrollW = 0;
}
}
margin = (winW/4)*(-1);
$("."+prefix+"container")
.width(winW) // Fixing the window width in case of scroll
.css({ marginLeft: margin-scrollW }); // Fixing the scroll gap
if ( initDocH > $("body").getOriginalContainer().height() ) {
$("body").getOriginalContainer().height( initDocH );
$("body").getCloneContainer().height( initDocH );
}
}
// Applying body background on the stereo containers
$("body").addClass("_3dsjq_");
$("body").getOriginalContainer().css({ background: bodyBack, backgroundSize: "100% 100%" });
$("body").getCloneContainer().css({ background: bodyBack, backgroundSize: "100% 100%" });
// Reinitiating the procedure on window resize
$(window).on({
resize: function(){
if ( stereoMode ) {
winW = $(window).width(),
winH = $(window).height();
adjustSideBySide(method);
}
}
});
}