Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d14a87ca
Commit
d14a87ca
authored
Aug 08, 2016
by
Chris Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving zoomed to top center, RTL Sass, reversing keys
parent
97f82f48
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
34 deletions
+27
-34
cms/static/sass/elements/_vendor.scss
+4
-3
common/lib/xmodule/xmodule/templates/html/zooming_image.yaml
+1
-0
common/static/js/vendor/image-zoom-tool.js
+22
-31
No files found.
cms/static/sass/elements/_vendor.scss
View file @
d14a87ca
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
.indicator
{
.indicator
{
display
:
none
;
display
:
none
;
position
:
absolute
;
position
:
absolute
;
left
:
46%
;
@include
left
(
46%
)
;
top
:
45%
;
top
:
45%
;
width
:
50px
;
width
:
50px
;
height
:
50px
;
height
:
50px
;
...
@@ -101,8 +101,9 @@
...
@@ -101,8 +101,9 @@
position
:
absolute
;
position
:
absolute
;
height
:
350px
;
height
:
350px
;
width
:
350px
;
width
:
350px
;
top
:
10%
!
important
;
top
:
-375px
;
right
:
-350px
!
important
;
@include
left
(
50%
);
@include
margin-left
(
-175px
);
border-radius
:
50%
;
border-radius
:
50%
;
border
:
2px
solid
$gray-d4
;
border
:
2px
solid
$gray-d4
;
background
:
$white
;
background
:
$white
;
...
...
common/lib/xmodule/xmodule/templates/html/zooming_image.yaml
View file @
d14a87ca
...
@@ -42,6 +42,7 @@ data: |
...
@@ -42,6 +42,7 @@ data: |
<div class="zooming-image-place" style="position: relative;">
<div class="zooming-image-place" style="position: relative;">
<a class="edx-zoom" href="https://studio.edx.org/c4x/edX/DemoX/asset/pathways_detail_01.png">
<a class="edx-zoom" href="https://studio.edx.org/c4x/edX/DemoX/asset/pathways_detail_01.png">
<img alt="magnify" src="https://studio.edx.org/c4x/edX/DemoX/asset/pathways_overview_01.png" />
<img alt="magnify" src="https://studio.edx.org/c4x/edX/DemoX/asset/pathways_overview_01.png" />
<span class="indicator icon fa fa-search-plus" aria-hidden="true"></span>
</a>
</a>
<div class="script_placeholder" data-src="https://studio.edx.org/c4x/edX/DemoX/asset/image-zoom-tool.js" />
<div class="script_placeholder" data-src="https://studio.edx.org/c4x/edX/DemoX/asset/image-zoom-tool.js" />
</div>
</div>
...
...
common/static/js/vendor/image-zoom-tool.js
View file @
d14a87ca
...
@@ -53,24 +53,22 @@
...
@@ -53,24 +53,22 @@
filter
:
'alpha(opacity=75)'
,
filter
:
'alpha(opacity=75)'
,
background
:
'#000'
background
:
'#000'
});
});
$errorMessage
$errorMessage
.
text
(
settings
.
errorMessage
)
.
text
(
settings
.
errorMessage
)
.
css
({
.
css
({
height
:
settings
.
height
,
height
:
settings
.
height
,
width
:
settings
.
width
width
:
settings
.
width
});
});
$loader
.
css
({
$loader
.
css
({
height
:
settings
.
height
,
height
:
settings
.
height
,
width
:
settings
.
width
width
:
settings
.
width
});
});
$t
his
.
on
(
'click keydown
'
,
function
(
event
)
{
$t
argetImage
.
on
(
'click
'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
});
$targetImage
.
on
(
'click'
,
function
(
event
)
{
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
var
left
=
event
.
pageX
,
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
top
=
event
.
pageY
;
...
@@ -80,7 +78,7 @@
...
@@ -80,7 +78,7 @@
}
}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
appendZoomed
();
appendZoomed
(
true
);
magnifyWithMouse
(
left
,
top
);
magnifyWithMouse
(
left
,
top
);
if
(
settings
.
lightbox
==
true
)
{
if
(
settings
.
lightbox
==
true
)
{
...
@@ -111,18 +109,16 @@
...
@@ -111,18 +109,16 @@
}).
mouseleave
(
function
()
{
}).
mouseleave
(
function
()
{
pulseZoomed
();
pulseZoomed
();
});
});
$imageArea
.
on
(
'keydown'
,
function
(
event
)
{
$imageArea
.
on
(
'keydown'
,
function
(
event
)
{
var
left
=
event
.
pageX
,
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
top
=
event
.
pageY
;
switch
(
event
.
which
)
{
switch
(
event
.
which
)
{
case
keys
.
tab
:
return
true
;
break
;
case
keys
.
enter
:
case
keys
.
enter
:
case
keys
.
space
:
case
keys
.
space
:
event
.
preventDefault
();
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
var
left
=
event
.
pageX
,
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
top
=
event
.
pageY
;
...
@@ -145,12 +141,9 @@
...
@@ -145,12 +141,9 @@
default
:
default
:
return
true
;
return
true
;
}
}
});
});
$zoomed
.
on
(
'keydown'
,
function
(
event
)
{
event
.
preventDefault
();
$zoomed
.
on
(
'keydown'
,
function
(
event
)
{
var
left
,
var
left
,
top
,
top
,
$zoomedImage
=
$zoomed
.
find
(
'img'
),
$zoomedImage
=
$zoomed
.
find
(
'img'
),
...
@@ -161,7 +154,7 @@
...
@@ -161,7 +154,7 @@
switch
(
event
.
which
)
{
switch
(
event
.
which
)
{
case
keys
.
esc
:
case
keys
.
esc
:
case
keys
.
tab
:
event
.
preventDefault
();
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
detachZoomed
();
detachZoomed
();
...
@@ -174,21 +167,25 @@
...
@@ -174,21 +167,25 @@
break
;
break
;
case
keys
.
up
:
case
keys
.
up
:
magnifyWithKeyboard
(
0
,
-
1
);
// we move two spaces at a time
magnifyWithKeyboard
(
0
,
2
,
event
);
break
;
break
;
case
keys
.
down
:
case
keys
.
down
:
magnifyWithKeyboard
(
0
,
1
);
// we move two spaces at a time
magnifyWithKeyboard
(
0
,
-
2
,
event
);
break
;
break
;
case
keys
.
left
:
case
keys
.
left
:
magnifyWithKeyboard
(
-
1
,
0
);
// we move two spaces at a time
magnifyWithKeyboard
(
2
,
0
,
event
);
break
;
break
;
case
keys
.
right
:
case
keys
.
right
:
magnifyWithKeyboard
(
1
,
0
);
// we move two spaces at a time
magnifyWithKeyboard
(
-
2
,
0
,
event
);
break
;
break
;
default
:
default
:
return
true
;
return
true
;
}
}
...
@@ -206,11 +203,6 @@
...
@@ -206,11 +203,6 @@
$
(
window
).
resize
(
function
()
{
$
(
window
).
resize
(
function
()
{
if
(
$zoomed
.
is
(
':visible'
))
{
if
(
$zoomed
.
is
(
':visible'
))
{
// $zoomed.css({
// left: $targetImage.offset().left + ($targetImage.width() / 2) - ($zoomed.width() / 2),
// top: $targetImage.offset().top + ($targetImage.height() / 2) - ($zoomed.height() / 2)
// });
$magnifiedImage
.
css
({
$magnifiedImage
.
css
({
left
:
-
(
$magnifiedImage
.
width
()
/
2
)
+
(
$zoomed
.
width
()
/
2
),
left
:
-
(
$magnifiedImage
.
width
()
/
2
)
+
(
$zoomed
.
width
()
/
2
),
top
:
-
(
$magnifiedImage
.
height
()
/
2
)
+
(
$zoomed
.
height
()
/
2
)
top
:
-
(
$magnifiedImage
.
height
()
/
2
)
+
(
$zoomed
.
height
()
/
2
)
...
@@ -242,11 +234,13 @@
...
@@ -242,11 +234,13 @@
left
:
magnifierLeft
left
:
magnifierLeft
});
});
};
};
function
magnifyWithKeyboard
(
left
,
top
)
{
function
magnifyWithKeyboard
(
left
,
top
,
event
)
{
var
newLeft
,
var
newLeft
,
newTop
;
newTop
;
event
.
preventDefault
();
newLeft
=
$magnifiedImage
.
css
(
'left'
);
newLeft
=
$magnifiedImage
.
css
(
'left'
);
newLeft
=
newLeft
.
replace
(
'px'
,
''
);
newLeft
=
newLeft
.
replace
(
'px'
,
''
);
newLeft
=
parseInt
(
newLeft
)
+
left
;
newLeft
=
parseInt
(
newLeft
)
+
left
;
...
@@ -324,9 +318,6 @@
...
@@ -324,9 +318,6 @@
$
.
fn
.
edxImageZoomTool
.
defaults
=
{
$
.
fn
.
edxImageZoomTool
.
defaults
=
{
zIndex
:
1000
,
zIndex
:
1000
,
// width: 150,
// height: 150,
// border: '2px solid #191919',
fadeSpeed
:
250
,
fadeSpeed
:
250
,
lightbox
:
true
,
lightbox
:
true
,
errorMessage
:
'Image load error'
errorMessage
:
'Image load error'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment