document-body

scrollTop() returns 0 in Firefox, but not in Chrome

北城以北 提交于 2019-11-27 15:46:21
问题 Not sure if there's another question regarding this, if so I apologize and please don't release the hounds. Using the html5 doctype and doing a quick console.log off my scroll listener that tells me the value of scrollTop() value. I'm basically doing this so when I scroll past a point, I change the opacity of an element. I'm doing this using an MVS solution and I don't have the ability to push this to an external site so you can look. Here's a quick snippet: var opacity = 1; var scrollTop = $

How can I disable print-screen functionality for a webpage in all browsers?

女生的网名这么多〃 提交于 2019-11-27 15:44:32
Using the following we can disable print-screens or screenshots in Internet Explorer: <body onload=setInterval("window.clipboardData.setData('text','')",2) oncontextmenu="return false" onselectstart="return false"> But these don't work in Mozilla, Chrome and other browsers. Is there a better way to disable print-screens/screenshots? What makes you think it's your decision if people should be able to take screenshots or not? Luckily no browser but IE allows you to access the clipboard via JavaScript so you are out of luck :) By the way, if I visited your site and it messed up my clipboard (it

Find body tag in an ajax HTML response

允我心安 提交于 2019-11-27 01:49:17
问题 I'm making an ajax call to fetch content and append this content like this: $(function(){ var site = $('input').val(); $.get('file.php', { site:site }, function(data){ mas = $(data).find('a'); mas.map(function(elem, index) { divs = $(this).html(); $('#result').append('' + divs + ''); }) }, 'html'); }); The problem is that when I change a in body I get nothing (no error, just no html). Im assuming body is a tag just like 'a' is? What am I doing wrong? So this works for me: mas = $(data).find(

When do you put Javascript in body, when in head and when use doc.load? [duplicate]

点点圈 提交于 2019-11-26 20:25:56
问题 Possible Duplicate: Where to place Javascript in a HTML file? Should I write script in the body or the head of the html? I've always wondered, mainly because when creating pages I always run into trouble, based on the following thing: When do you write your javascript In the <head> In the <body> with a $(document).ready() I could be stupid, but I've had a few times when my JavaScript (/jQuery) wasn't executed because of the wrong place or yes or no doc.ready() command. So I'm really wondering

How can I disable print-screen functionality for a webpage in all browsers?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 12:48:04
问题 Using the following we can disable print-screens or screenshots in Internet Explorer: <body onload=setInterval(\"window.clipboardData.setData(\'text\',\'\')\",2) oncontextmenu=\"return false\" onselectstart=\"return false\"> But these don\'t work in Mozilla, Chrome and other browsers. Is there a better way to disable print-screens/screenshots? 回答1: What makes you think it's your decision if people should be able to take screenshots or not? Luckily no browser but IE allows you to access the