When We build a web application, we do not want the users to use the right button of the mouse.Today, many of the code examples used to disable the right-click no longer work in most browsers and browsers such as Opera do not allow the right-mouse button to be disabled. Anyway we can disable right click using jQuery or JavaScript.
Detecting mobile devices using jquery or javascript
Now a days, mobile is a common device in everyone’s hand. Internet is also used very much using these devices. So for web world, It is a challenge to be compatible their websites with these devices. For that, every application should be detect mobile device. Every language has its own method to detect the mobile device but we are explaining here the way of detecting mobile devices using jQuery or JAVASCRIPT.
Undefined property $db in Codeigniter
Are you facing any notice saying Undefined property: Home::$db or something like this in your Codeigniter application? The reason behind the error Undefined property $db in Codeigniter arises because you didn’t load database library in your controller/method to use any function of it.
To change navbar color in Twitter Bootstrap 3
Twitter Bootstrap is a popular front-end framework to create responsive websites with some popular JavaScript plugins. Here is a workaround to change navbar color in Twitter Bootstrap 3 instead of using the two basic navbar colors (light one / dark one) available.
<!-- A light one --> <nav class="navbar navbar-default" role="navigation"></nav> <!-- A dark one --> <nav class="navbar navbar-inverse" role="navigation"></nav>
Automatic Update Copyright Year
Still wonder how to automatic update copyright year instead of changing hard-coded value each year. Lol!! You need some fresh air to let your mind breathe. Use PHP’s date() function which can echo the current year in your copyright text.
Copyright ©< ?php echo date('Y'); ?> | Your Company Name
Remove bullets from unordered list
By default Unordered List in HTML render bullets on webpage. To remove bullets from unordered list you can set CSS rule list-style-type: none; for ‘ul’.
Inline Style: <ul style="list-style: none;"><li>...</li></ul>
3 functions to check if string contains specific words
check for existence of a substring into a string is a common requirement for programmers. Here I’m describing 3 functions to check if string contains specific words.
- strpos – Find the position of the first occurrence of a substring in a string.
- strstr – Find the first occurrence of a string
- preg_match – Perform a regular expression match
How to speed up page rendering
In website, speed up page rendering is very important factor. Because if our page speed is fast then visitors can visit more pages on our site and can take a glance easily. We have to make our web pages fast but it’s not too easy to optimize web pages at each and every scale.
Bootstrap 3 Pagination in WordPress
The function below will assist you to smoothly add pagination in your WordPress theme using Twitter Bootstrap 3 pagination style. This function is easy to read and to customize as well as contains features like:
- Bootstrap Styling
- First and Last Button
- Previous and Next Button
- Current page & total number of pages
- First/Last text invisible on small devices
- Previous/Next text invisible on small devices
- Works with custom post types by passing parameters to function
Hide or remove basic/web from URL in Yii 2.0
Yii is a awesome framework that does many things automatically. As you know, the default installation of Yii App makes site accessible via URL ‘http://www.example.com/basic/web/index.php’ or something like this but in a production server you may wish to hide or remove basic/web from URL in Yii 2.0 as well as access it with SEO friendly URL (‘http://www.example.com/controller/action’).