jquery

Unable to use navigator.geolocation due to 'Only secure origins are allowed'

前提是你 提交于 2021-02-08 15:12:12
问题 There has been an error, in the console, since I made my website using navigator.geolocation.getCurrentPosition (below). I realised this was going to cause a problem at some point in the future, and as I'm only playing with web development it didn't concern me that much, but it has now completely screwed up my little weather app (http://conn3cted.uk.tn/weather.html) as it seems that I can't use this function in chrome (it works in firefox) anymore. The error I'm getting additionally now is

Unable to use navigator.geolocation due to 'Only secure origins are allowed'

≡放荡痞女 提交于 2021-02-08 15:09:22
问题 There has been an error, in the console, since I made my website using navigator.geolocation.getCurrentPosition (below). I realised this was going to cause a problem at some point in the future, and as I'm only playing with web development it didn't concern me that much, but it has now completely screwed up my little weather app (http://conn3cted.uk.tn/weather.html) as it seems that I can't use this function in chrome (it works in firefox) anymore. The error I'm getting additionally now is

DataTables search on specific columns

守給你的承諾、 提交于 2021-02-08 15:05:19
问题 I have adapted the following webpage to my needs and added a bit of code so it now has select2 dropdown menus instead of regular select menus (which I like a LOT better). However I have not been able to figure out how to adapt the code so I can use it only on specific columns instead of on every column. Any guidance would be greatly appreciated. http://datatables.net/examples/api/multi_filter_select.html (code I adapted) initComplete: function () { this.api().columns().every( function () {

DataTables search on specific columns

青春壹個敷衍的年華 提交于 2021-02-08 15:05:04
问题 I have adapted the following webpage to my needs and added a bit of code so it now has select2 dropdown menus instead of regular select menus (which I like a LOT better). However I have not been able to figure out how to adapt the code so I can use it only on specific columns instead of on every column. Any guidance would be greatly appreciated. http://datatables.net/examples/api/multi_filter_select.html (code I adapted) initComplete: function () { this.api().columns().every( function () {

how to use vh units instead of pixels for .scrolltop functions

风格不统一 提交于 2021-02-08 14:48:32
问题 I have a menu bar who's class I want to change after a users scrolls to the next div, the div is 100vh tall. The function below works only with screens my size, anything smaller or bigger the animation will go to early or too late. How do I make the units that this function uses vh? Thanks $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 600) { <---- change to vh units not px----- $(".home").removeClass("open"); } 回答1: 100vh is the actual view height of that

Select2: Can't create new options longer than 2 characters (tag: true)

a 夏天 提交于 2021-02-08 14:29:37
问题 I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle <select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]"> <option value="4">Text1</option> <option value="1">Text2</option> <option value="3">Text3</option>

Select2: Can't create new options longer than 2 characters (tag: true)

只谈情不闲聊 提交于 2021-02-08 14:29:08
问题 I have a Select2 Box, with tagging enabled to add new own tags. Selecting an existing option works without any problem (of any length). But some code prevents me from adding a new option longer than 2 characters long (just can't add more characters). See the JSFiddle <select class="form-control select2" multiple="multiple" id="employee-groups-select" name="employee[employee_group_ids][]"> <option value="4">Text1</option> <option value="1">Text2</option> <option value="3">Text3</option>

How to check if current time falls within a specific range on a week day using jquery/javascript?

只谈情不闲聊 提交于 2021-02-08 14:13:20
问题 When a user visits a page I need to check if the current time falls between 9:00 am and 5:30pm on a weekday and display something using jquery/javascript.But I am not sure how can check that. Could someone please help? Thanks 回答1: This should hopefully help: function checkTime() { var d = new Date(); // current time var hours = d.getHours(); var mins = d.getMinutes(); var day = d.getDay(); return day >= 1 && day <= 5 && hours >= 9 && (hours < 17 || hours === 17 && mins <= 30); } 回答2: var now

How to check if current time falls within a specific range on a week day using jquery/javascript?

北慕城南 提交于 2021-02-08 14:13:02
问题 When a user visits a page I need to check if the current time falls between 9:00 am and 5:30pm on a weekday and display something using jquery/javascript.But I am not sure how can check that. Could someone please help? Thanks 回答1: This should hopefully help: function checkTime() { var d = new Date(); // current time var hours = d.getHours(); var mins = d.getMinutes(); var day = d.getDay(); return day >= 1 && day <= 5 && hours >= 9 && (hours < 17 || hours === 17 && mins <= 30); } 回答2: var now

How to unselect options in select using jquery

守給你的承諾、 提交于 2021-02-08 13:59:16
问题 Below is my HTML. I have given multiple option elements in the select tag. <select class="car" multiple size="3"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> </select> I am able to multi-select by holding the CTRL key. I am able to retrieve the selected values using the following jQuery $.each($(".car option:selected"), function() { countries.push($(this).val()); }); How can I unselect the value