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 @@
.indicator
{
display
:
none
;
position
:
absolute
;
left
:
46%
;
@include
left
(
46%
)
;
top
:
45%
;
width
:
50px
;
height
:
50px
;
...
...
@@ -101,8 +101,9 @@
position
:
absolute
;
height
:
350px
;
width
:
350px
;
top
:
10%
!
important
;
right
:
-350px
!
important
;
top
:
-375px
;
@include
left
(
50%
);
@include
margin-left
(
-175px
);
border-radius
:
50%
;
border
:
2px
solid
$gray-d4
;
background
:
$white
;
...
...
common/lib/xmodule/xmodule/templates/html/zooming_image.yaml
View file @
d14a87ca
...
...
@@ -42,6 +42,7 @@ data: |
<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">
<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>
<div class="script_placeholder" data-src="https://studio.edx.org/c4x/edX/DemoX/asset/image-zoom-tool.js" />
</div>
...
...
common/static/js/vendor/image-zoom-tool.js
View file @
d14a87ca
...
...
@@ -53,24 +53,22 @@
filter
:
'alpha(opacity=75)'
,
background
:
'#000'
});
$errorMessage
.
text
(
settings
.
errorMessage
)
.
css
({
height
:
settings
.
height
,
width
:
settings
.
width
});
$loader
.
css
({
height
:
settings
.
height
,
width
:
settings
.
width
});
$t
his
.
on
(
'click keydown
'
,
function
(
event
)
{
$t
argetImage
.
on
(
'click
'
,
function
(
event
)
{
event
.
preventDefault
();
});
$targetImage
.
on
(
'click'
,
function
(
event
)
{
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
...
...
@@ -80,7 +78,7 @@
}
setTimeout
(
function
()
{
appendZoomed
();
appendZoomed
(
true
);
magnifyWithMouse
(
left
,
top
);
if
(
settings
.
lightbox
==
true
)
{
...
...
@@ -111,18 +109,16 @@
}).
mouseleave
(
function
()
{
pulseZoomed
();
});
$imageArea
.
on
(
'keydown'
,
function
(
event
)
{
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
switch
(
event
.
which
)
{
case
keys
.
tab
:
return
true
;
break
;
case
keys
.
enter
:
case
keys
.
space
:
event
.
preventDefault
();
if
(
!
$zoomed
.
hasClass
(
'is-visible'
))
{
var
left
=
event
.
pageX
,
top
=
event
.
pageY
;
...
...
@@ -145,12 +141,9 @@
default
:
return
true
;
}
});
$zoomed
.
on
(
'keydown'
,
function
(
event
)
{
event
.
preventDefault
();
$zoomed
.
on
(
'keydown'
,
function
(
event
)
{
var
left
,
top
,
$zoomedImage
=
$zoomed
.
find
(
'img'
),
...
...
@@ -161,7 +154,7 @@
switch
(
event
.
which
)
{
case
keys
.
esc
:
case
keys
.
tab
:
event
.
preventDefault
();
if
(
$zoomed
.
hasClass
(
'is-visible'
))
{
detachZoomed
();
...
...
@@ -174,21 +167,25 @@
break
;
case
keys
.
up
:
magnifyWithKeyboard
(
0
,
-
1
);
// we move two spaces at a time
magnifyWithKeyboard
(
0
,
2
,
event
);
break
;
case
keys
.
down
:
magnifyWithKeyboard
(
0
,
1
);
// we move two spaces at a time
magnifyWithKeyboard
(
0
,
-
2
,
event
);
break
;
case
keys
.
left
:
magnifyWithKeyboard
(
-
1
,
0
);
// we move two spaces at a time
magnifyWithKeyboard
(
2
,
0
,
event
);
break
;
case
keys
.
right
:
magnifyWithKeyboard
(
1
,
0
);
// we move two spaces at a time
magnifyWithKeyboard
(
-
2
,
0
,
event
);
break
;
default
:
return
true
;
}
...
...
@@ -206,11 +203,6 @@
$
(
window
).
resize
(
function
()
{
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
({
left
:
-
(
$magnifiedImage
.
width
()
/
2
)
+
(
$zoomed
.
width
()
/
2
),
top
:
-
(
$magnifiedImage
.
height
()
/
2
)
+
(
$zoomed
.
height
()
/
2
)
...
...
@@ -242,11 +234,13 @@
left
:
magnifierLeft
});
};
function
magnifyWithKeyboard
(
left
,
top
)
{
function
magnifyWithKeyboard
(
left
,
top
,
event
)
{
var
newLeft
,
newTop
;
event
.
preventDefault
();
newLeft
=
$magnifiedImage
.
css
(
'left'
);
newLeft
=
newLeft
.
replace
(
'px'
,
''
);
newLeft
=
parseInt
(
newLeft
)
+
left
;
...
...
@@ -324,9 +318,6 @@
$
.
fn
.
edxImageZoomTool
.
defaults
=
{
zIndex
:
1000
,
// width: 150,
// height: 150,
// border: '2px solid #191919',
fadeSpeed
:
250
,
lightbox
:
true
,
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