Is there a way to do that?
besides disabling right click on the site.
Thanks @Waldo_Broodryk, i was wondering where you are!
But thatâs for disabling right click, i can still highlight a text section and then (cntrl +c, cntrl +v) copy paste them, how do i disable that?
Haha, it has information on how to do it is on the page. Iâll type of our once Iâm home
Should just be the following @Nir. Add the following html code to your BODY tag:
<body ondragstart="return false" onselectstart="return false">
Havenât tested it yet.
Wrap this with <script></script>
tags and put it in Footer Code in site dashboard Custom Code section.
You can adjust that to ANY character pressed with CTRL key. Look at the following website with keycodes: Javascript Char Codes (Key Codes) - Cambia Research
Youâre welcome :)
$(document).keydown(function(e) {
// 67 == C
if (e.keyCode == 67 && e.ctrlKey) {
e.preventDefault();
console.log('no no no. you cant ctrl+c');
}
// 86 == V
if (e.keyCode == 86 && e.ctrlKey) {
e.preventDefault();
console.log('no no no. you cant ctrl+v');
}
});
What about for macs? Do I just change the ctrl to cmd?
Unlike Shift/Alt/Ctrl, Mac/Apple key is not considered as a modifier keyâinstead, you should hook on keydown/keyup and record when a key is pressed and then depressed based on event.keyCode.
Unfortunately, these key codes are browser-dependent:
Firefox: 224 Opera: 17 WebKit (Safari/Chrome): 91 (Left Apple) or 93 (Right Apple)
from
@bartekkustra hope you donât mind me asking you another question.
Have any idea how to create this âsoftâ scrolling effect?
http://www.werkstatt.fr
Just to ease the scrolling so it wont be so âsharpâ.
Thank you!
I donât mind :)
Unfortunately for now I have no idea how to create such thing⌠I might need to work on that. Drop me that question at www.barts.work so I wonât forget that.
@bartekkustra this kinda works, not 100% the same like the link, but it does the job.
var $window = $(window),
scrollDistance = 170,
scrollSpeed = 400,
scrollEffect = 'swing',
scrollAmount = 1,
smoothScroll;
if (! (âontouchstartâ in document.documentElement) && ! $(âbodyâ).hasClass(âmodal-openâ)) {
$window.on("mousewheel DOMMouseScroll", function (event) {
event.preventDefault();
if (smoothScroll) {
// Start scrolling while waiting for final scoll amount (user stopped wheeling)
if (scrollAmount == 1) {
var delta = event.originalEvent.wheelDelta / 120 || -event.originalEvent.detail / 3;
var finalScroll = $window.scrollTop() - parseInt(delta * (scrollDistance * scrollAmount));
$('html, body').stop().animate({ scrollTop: finalScroll }, scrollSpeed, scrollEffect);
}
// Increase scroll amount
scrollAmount++;
// Clear current timeout
clearTimeout(smoothScroll);
}
// Set animated scroll
smoothScroll = setTimeout(function() {
var delta = event.originalEvent.wheelDelta / 120 || -event.originalEvent.detail / 3;
var scrollTop = $window.scrollTop();
var finalScroll = scrollTop - parseInt(delta * (scrollDistance * scrollAmount));
// Reset scroll amoount
scrollAmount = 1;
$('html, body').stop().animate({ scrollTop: finalScroll },
(scrollSpeed*scrollAmount),
scrollEffect
);
// Clear timeout holder
smoothScroll = null;
}, 100);
});
}
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.