tag:blogger.com,1999:blog-88873429518162530032024-03-23T03:17:33.713-07:00Psd to Html BlogUnknownnoreply@blogger.comBlogger34125tag:blogger.com,1999:blog-8887342951816253003.post-13931248686535990822024-03-13T04:44:00.000-07:002024-03-13T04:47:54.266-07:00React Navigation for multiple pages<p> In React Native, React Navigation is a popular library used for managing navigation in your application. It provides several navigation solutions, including Stack Navigator, Tab Navigator, Drawer Navigator, and more. Here's a basic example of setting up navigation for multiple pages using React Navigation:</p><ol><li>First, make sure you have React Navigation installed in your project. You can install it via npm or yarn:</li></ol><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">npm install @react-navigation/native
</code></div></div></pre><p>or</p><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">yarn add @react-navigation/native
</code></div></div></pre><ol start="2"><li>Install dependencies for the navigator you want to use. For example, if you want to use Stack Navigator:</li></ol><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">npm install react-native-screens react-native-safe-area-context
</code></div></div></pre><p>or</p><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">yarn add react-native-screens react-native-safe-area-context
</code></div></div></pre><ol start="3"><li>Now, let's create some screens for navigation. For this example, let's create two screens: <code>HomeScreen</code> and <code>DetailScreen</code>.</li></ol><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>jsx</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-jsx"><span class="hljs-comment">// HomeScreen.js</span>
<span class="hljs-keyword">import</span> <span class="hljs-title class_">React</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">View</span>, <span class="hljs-title class_">Text</span>, <span class="hljs-title class_">Button</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
<span class="hljs-keyword">const</span> <span class="hljs-title function_">HomeScreen</span> = (<span class="hljs-params">{ navigation }</span>) => {
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">View</span>></span>
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>This is the Home Screen<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
<span class="hljs-tag"><<span class="hljs-name">Button</span>
<span class="hljs-attr">title</span>=<span class="hljs-string">"Go to Details"</span>
<span class="hljs-attr">onPress</span>=<span class="hljs-string">{()</span> =></span> navigation.navigate('Details')}
/>
<span class="hljs-tag"></<span class="hljs-name">View</span>></span></span>
);
};
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-title class_">HomeScreen</span>;
</code></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>jsx</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-jsx"><span class="hljs-comment">// DetailScreen.js</span>
<span class="hljs-keyword">import</span> <span class="hljs-title class_">React</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">View</span>, <span class="hljs-title class_">Text</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
<span class="hljs-keyword">const</span> <span class="hljs-title function_">DetailScreen</span> = (<span class="hljs-params"></span>) => {
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">View</span>></span>
<span class="hljs-tag"><<span class="hljs-name">Text</span>></span>This is the Detail Screen<span class="hljs-tag"></<span class="hljs-name">Text</span>></span>
<span class="hljs-tag"></<span class="hljs-name">View</span>></span></span>
);
};
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-title class_">DetailScreen</span>;
</code></div></div></pre><ol start="4"><li>Now, let's set up the navigation structure in your main component.</li></ol><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>jsx</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-jsx"><span class="hljs-comment">// App.js</span>
<span class="hljs-keyword">import</span> <span class="hljs-title class_">React</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">NavigationContainer</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'@react-navigation/native'</span>;
<span class="hljs-keyword">import</span> { createStackNavigator } <span class="hljs-keyword">from</span> <span class="hljs-string">'@react-navigation/stack'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title class_">HomeScreen</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'./HomeScreen'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title class_">DetailScreen</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'./DetailScreen'</span>;
<span class="hljs-keyword">const</span> <span class="hljs-title class_">Stack</span> = <span class="hljs-title function_">createStackNavigator</span>();
<span class="hljs-keyword">const</span> <span class="hljs-title function_">App</span> = (<span class="hljs-params"></span>) => {
<span class="hljs-keyword">return</span> (
<span class="xml"><span class="hljs-tag"><<span class="hljs-name">NavigationContainer</span>></span>
<span class="hljs-tag"><<span class="hljs-name">Stack.Navigator</span>></span>
<span class="hljs-tag"><<span class="hljs-name">Stack.Screen</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Home"</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{HomeScreen}</span> /></span>
<span class="hljs-tag"><<span class="hljs-name">Stack.Screen</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Details"</span> <span class="hljs-attr">component</span>=<span class="hljs-string">{DetailScreen}</span> /></span>
<span class="hljs-tag"></<span class="hljs-name">Stack.Navigator</span>></span>
<span class="hljs-tag"></<span class="hljs-name">NavigationContainer</span>></span></span>
);
};
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-title class_">App</span>;
</code></div></div></pre><ol start="5"><li>Finally, make sure to render your <code>App</code> component in your <code>index.js</code> file or wherever you have your root component.</li></ol><pre><div class="dark bg-gray-950 rounded-md"><div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>jsx</span><span class="" data-state="closed"></span></div></div></pre><pre><div class="dark bg-gray-950 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-jsx"><span class="hljs-comment">// index.js</span>
<span class="hljs-keyword">import</span> <span class="hljs-title class_">React</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { <span class="hljs-title class_">AppRegistry</span> } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-native'</span>;
<span class="hljs-keyword">import</span> <span class="hljs-title class_">App</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'./App'</span>;
<span class="hljs-keyword">import</span> { name <span class="hljs-keyword">as</span> appName } <span class="hljs-keyword">from</span> <span class="hljs-string">'./app.json'</span>;
<span class="hljs-keyword">const</span> <span class="hljs-title function_">Main</span> = (<span class="hljs-params"></span>) => <span class="xml"><span class="hljs-tag"><<span class="hljs-name">App</span> /></span></span>;
<span class="hljs-title class_">AppRegistry</span>.<span class="hljs-title function_">registerComponent</span>(appName, <span class="hljs-function">() =></span> <span class="hljs-title class_">Main</span>);
</code></div></div></pre><p>Now you should have a basic navigation setup with two screens: <code>HomeScreen</code> and <code>DetailScreen</code>. When you press the button on the <code>HomeScreen</code>, it should navigate to the <code>DetailScreen</code>. You can extend this navigation structure further by adding more screens and configuring the navigator according to your app's requirements.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-62188399878655098602024-01-01T22:27:00.000-08:002024-01-01T22:27:41.045-08:00What is the purpose of JSX in React? Does it offer any performance benefits over writing plain HTML/CSS/JS?<p> JSX in React is a syntax extension that allows you to write HTML-like code directly within JavaScript. Its purpose is to make the creation of React components more intuitive and simpler by combining the power of JavaScript with the structure of HTML.</p><div class="flex flex-grow flex-col max-w-full"><div class="min-h-[20px] text-message flex flex-col items-start gap-3 whitespace-pre-wrap break-words [.text-message+&]:mt-5 overflow-x-auto" data-message-author-role="assistant" data-message-id="a923c191-b399-4925-88ce-c03e7fde955d"><div class="markdown prose w-full break-words dark:prose-invert light"><p>JSX provides several advantages:</p><ol><li><p><strong>Simplified Syntax</strong>: JSX makes it easier to visualize and write component structures by resembling HTML, which developers are generally more familiar with. It allows embedding JavaScript expressions within curly braces <code>{}</code> directly in the markup.</p></li><li><p><strong>Component Rendering</strong>: JSX simplifies the rendering of React components, enabling the use of familiar HTML-like tags to define UI components. This declarative style often leads to more readable and maintainable code.</p></li><li><p><strong>JavaScript Power</strong>: Being embedded within JavaScript, JSX allows leveraging the full power of JavaScript expressions, such as variables, loops, and conditional statements, directly within the markup.</p></li></ol><p>Regarding performance benefits, JSX itself doesn’t offer direct performance improvements over writing plain HTML/CSS/JS. When JSX is transpiled (converted) into JavaScript by tools like Babel, it essentially transforms JSX into plain JavaScript function calls (React.createElement()). React then uses these function calls to construct the virtual DOM, which it uses for efficient updates.</p><p>React's performance gains come from its virtual DOM implementation, not directly from JSX. The virtual DOM enables React to efficiently update the actual DOM by first updating a lightweight representation of it. When changes occur, React compares the virtual DOM with the actual DOM and applies only the necessary updates, minimizing direct manipulations to the browser's DOM, which can be costly in terms of performance.</p><p>While JSX itself doesn’t improve performance, React's underlying mechanisms, combined with JSX's ease of use and developer ergonomics, contribute to creating more performant web applications.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-16909718853813572662023-07-27T01:42:00.001-07:002023-07-27T01:42:03.313-07:00Securing your CDN: Why and how should you use SRI<p> </p><p>Securing your Content Delivery Network (CDN) is essential to protect your website's visitors from potential security risks, such as content tampering and data breaches. One effective method to enhance the security of your CDN-served content is by using Subresource Integrity (SRI).</p><p>Subresource Integrity (SRI) is a security feature that allows you to ensure the integrity and authenticity of your CDN-hosted resources, such as JavaScript files, CSS stylesheets, and fonts. It works by adding an extra layer of validation to the way these resources are loaded on your website. When SRI is used, the browser checks the integrity of the resource before executing or rendering it, ensuring that it hasn't been altered or compromised in transit.</p><p>Here's why and how you should use SRI with your CDN:</p><p><strong>1. Preventing Code Injection and Tampering:</strong>
SRI helps prevent code injection attacks, where malicious actors can modify your CDN resources and introduce harmful code into your website. By ensuring the integrity of the resources, SRI prevents the browser from executing altered code.</p><p><strong>2. Protecting User Data:</strong>
If your website includes scripts from third-party sources (e.g., external libraries), using SRI ensures that these scripts are served from the intended sources. It prevents potential man-in-the-middle attacks and safeguards user data from being leaked or manipulated.</p><p><strong>3. Ensuring Consistent User Experience:</strong>
SRI ensures that your website's resources are loaded as intended, without any unauthorized modifications. This consistency is crucial for providing a reliable and trustworthy user experience.</p><p><strong>How to Implement SRI:</strong></p><ol><li><p><strong>Generate Hashes for Your Resources:</strong>
The first step is to generate the cryptographic hashes (specifically, SHA-256) for each of the resources you want to protect. These hashes will act as a unique fingerprint for the files.</p></li><li><p><strong>Add SRI Attributes to Resource Links:</strong>
Once you have the hashes, add the "integrity" attribute to the HTML tags that reference the resources. The attribute's value should be in the following format:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>makefile</span></div></div></pre></li></ol><ol><li value="2"><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-makefile">integrity=<span class="hljs-string">"sha256-abcdef1234567890..."</span>
</code></div></div></pre></li><li><p><strong>Specify the Resource's Origin:</strong>
For added security, it's recommended to include the "crossorigin" attribute in the resource link. This attribute helps define how the browser handles requests based on the resource's origin. For CDNs, you can use "anonymous" or "use-credentials" as the value.</p></li></ol><p><strong>Example of Using SRI with a Script Tag:</strong></p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>html</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-html"><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://cdn.example.com/jquery.js"</span> <span class="hljs-attr">integrity</span>=<span class="hljs-string">"sha256-abcdef1234567890..."</span> <span class="hljs-attr">crossorigin</span>=<span class="hljs-string">"anonymous"</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
</code></div></div></pre><p><strong>Important Considerations:</strong></p><ul><li><p>Ensure that your CDN supports serving resources with SRI attributes. Most reputable CDNs provide this feature.</p></li><li><p>Periodically review and update the SRI hashes when the resources change to maintain their accuracy and effectiveness.</p></li><li><p>While SRI helps protect your users from some security risks, it's not a substitute for other security measures like HTTPS. Always use HTTPS to secure your entire website.</p></li></ul><p>By using Subresource Integrity (SRI) with your CDN-served resources, you can significantly enhance the security of your website and protect your users from potential security threats arising from compromised resources.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-79328282512752580232023-07-27T01:40:00.004-07:002023-07-27T01:40:22.771-07:00Developer essentials: How to search code using grep<p> Searching code using <code>grep</code> is a powerful and efficient way to find specific patterns or text within files. <code>grep</code> is a command-line utility available on Unix-based systems (e.g., Linux and macOS) and can be used on Windows through tools like Cygwin or Windows Subsystem for Linux (WSL). Here's a step-by-step guide on how to use <code>grep</code> for code searching:</p><p><strong>1. Open a terminal:</strong>
On Unix-based systems, open a terminal or command prompt. On Windows with Cygwin or WSL, open the corresponding terminal.</p><p><strong>2. Basic syntax:</strong>
The basic syntax of <code>grep</code> is as follows:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>css</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-css">grep <span class="hljs-selector-attr">[options]</span> pattern <span class="hljs-selector-attr">[file...]</span>
</code></div></div></pre><ul><li><code>pattern</code>: The text or regular expression you want to search for.</li><li><code>file...</code>: Optional. The file(s) in which you want to search. If not specified, <code>grep</code> will read from the standard input.</li></ul><p><strong>3. Search for a specific pattern in a single file:</strong>
To search for a specific pattern (e.g., "example") in a single file (e.g., myfile.txt), you can use:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> <span class="hljs-string">"example"</span> myfile.txt
</code></div></div></pre><p>This will display all lines containing the word "example" in the file <code>myfile.txt</code>.</p><p><strong>4. Search for a pattern in multiple files:</strong>
You can search for the same pattern in multiple files by providing a list of filenames. For example:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> <span class="hljs-string">"example"</span> file1.txt file2.txt file3.txt
</code></div></div></pre><p><strong>5. Case-insensitive search:</strong>
By default, <code>grep</code> is case-sensitive. To perform a case-insensitive search, use the <code>-i</code> option:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> -i <span class="hljs-string">"example"</span> myfile.txt
</code></div></div></pre><p><strong>6. Search for whole words only:</strong>
If you want to search for the exact word "example" and not substrings containing that word, use the <code>-w</code> option:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> -w <span class="hljs-string">"example"</span> myfile.txt
</code></div></div></pre><p><strong>7. Search recursively in directories:</strong>
To search for a pattern in all files within a directory and its subdirectories, use the <code>-r</code> (recursive) option:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">grep -r <span class="hljs-string">"example"</span> /path/to/directory
</code></div></div></pre><p><strong>8. Invert match:</strong>
If you want to see lines that do not match the pattern, use the <code>-v</code> option:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> -v <span class="hljs-string">"example"</span> myfile.txt
</code></div></div></pre><p>This will show all lines in <code>myfile.txt</code> that do not contain the word "example."</p><p><strong>9. Use regular expressions:</strong>
<code>grep</code> allows you to use powerful regular expressions for more complex searches. For example:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>perl</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-perl"><span class="hljs-keyword">grep</span> <span class="hljs-string">"foo.*bar"</span> myfile.txt
</code></div></div></pre><p>This searches for lines containing "foo" followed by any characters and then "bar."</p><p>These are some of the essential <code>grep</code> options for code searching. It's a versatile tool and can be combined with other Unix commands to achieve even more powerful searches. To learn more about <code>grep</code> and its additional options, you can check its manual page by running <code>man grep</code> in the terminal.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-57440166312676916882023-07-03T02:08:00.002-07:002023-07-03T02:08:35.222-07:00Creating a Semi-Transparent Background with Blur Effect in CSS<p> Here's a breakdown of how to use it:</p><ol><li><p>Background Color:
The <code>background-color</code> property sets the background color of an element. In this case, the color is set to white with an alpha (transparency) value of 0.6. The alpha value ranges from 0 (completely transparent) to 1 (fully opaque).</p></li><li><p>Backdrop Filter (for WebKit-based browsers):
The <code>-webkit-backdrop-filter</code> property applies a visual effect to the area behind the element, creating a blur effect. In this case, the <code>blur()</code> function is used to specify the amount of blur. Here, it is set to 8 pixels.</p></li><li><p>Backdrop Filter (for non-WebKit browsers):
The <code>backdrop-filter</code> property is a standard CSS property that works in non-WebKit browsers to apply a similar visual effect. It also uses the <code>blur()</code> function with a value of 8 pixels.</p></li></ol><p>To apply these styles to an HTML element, you can use CSS. Here's an example:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>html</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-html"><span class="hljs-tag"><<span class="hljs-name">style</span>></span><span class="css">
<span class="hljs-selector-class">.my-element</span> {
<span class="hljs-attribute">background-color</span>: <span class="hljs-built_in">rgba</span>(<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0.6</span>);
-webkit-backdrop-<span class="hljs-attribute">filter</span>: <span class="hljs-built_in">blur</span>(<span class="hljs-number">8px</span>);
backdrop-<span class="hljs-attribute">filter</span>: <span class="hljs-built_in">blur</span>(<span class="hljs-number">8px</span>);
}
</span><span class="hljs-tag"></<span class="hljs-name">style</span>></span>
<span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"my-element"</span>></span>
<span class="hljs-comment"><!-- Content goes here --></span>
<span class="hljs-tag"></<span class="hljs-name">div</span>></span>
</code></div></div></pre><p>In this example, the <code>.my-element</code> class is applied to a <code><div></code> element, but you can use it with any other HTML element. The background color will be white with a transparency of 0.6, and the backdrop filter will create a blur effect with a radius of 8 pixels.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-25665369733317448522023-06-04T21:54:00.000-07:002023-06-04T21:54:05.873-07:00How can I know if a JS, HTML, or CSS file is well formatted via Bash?<p> </p><p>To check the formatting of JavaScript, HTML, or CSS files using Bash, you can use various tools that provide command-line interfaces. Here are a few popular options:</p><ol><li><p>ESLint (for JavaScript):
ESLint is a widely used linter for JavaScript. You can install it globally using npm (Node Package Manager) and then use it to check the formatting of JavaScript files. Here's an example command to check the formatting of a JavaScript file named "script.js":</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span></div></div></pre></li></ol><div class="markdown prose w-full break-words dark:prose-invert light"><li><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">npx eslint --fix script.js
</code></div></div></pre><p>The <code>--fix</code> flag tries to automatically fix any formatting errors it can.</p></li><li><p>HTMLHint (for HTML):
HTMLHint is a linter specifically designed for HTML files. You can install it globally using npm and then use it to validate the formatting of HTML files. Here's an example command to check the formatting of an HTML file named "index.html":</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span></div></div></pre></li><li><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">npx htmlhint index.html
</code></div></div></pre></li><li><p>Stylelint (for CSS):
Stylelint is a popular linter for CSS. Similar to the previous tools, you can install it globally using npm and then use it to check the formatting of CSS files. Here's an example command to check the formatting of a CSS file named "styles.css":</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>bash</span></div></div></pre></li><ol><li value="3"><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-bash">npx stylelint styles.css
</code></div></div></pre></li></ol><p>Make sure you have Node.js and npm installed on your system before using the above commands. These tools provide extensive configuration options, allowing you to customize the formatting rules according to your project's requirements. Refer to the respective documentation for more details on configuration options and advanced usage.</p></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-82235365198717243452023-05-24T20:51:00.005-07:002023-05-24T20:51:52.501-07:00Assigning Values to Nullable Variables in Flutter<p>In Flutter, if you have a nullable variable and you want to assign a new value to it, you can use the null-aware assignment operator (<code>??=</code>) or the regular assignment operator (<code>=</code>) along with a null check.</p><p>Here's an example:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>dart</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-dart">String? nullableVariable;
void assignValue(String newValue) {
nullableVariable ??= newValue;
}
</code></div></div></pre><p>In the code snippet above, we have a nullable variable <code>nullableVariable</code> of type <code>String?</code>. The <code>assignValue</code> function takes a <code>newValue</code> parameter and assigns it to <code>nullableVariable</code> if <code>nullableVariable</code> is currently null. If <code>nullableVariable</code> already has a value, it remains unchanged.</p><p>The null-aware assignment operator (<code>??=</code>) checks if the variable on the left side is null and assigns the value on the right side only if the variable is null. If the variable already has a non-null value, the assignment operation is skipped.</p><p>Alternatively, if you want to assign a new value to a nullable variable with a null check, you can use the regular assignment operator (<code>=</code>) along with a null check:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>dart</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-dart">String? nullableVariable;
void assignValue(String newValue) {
if (nullableVariable == null) {
nullableVariable = newValue;
}
}
</code></div></div></pre><p>In this case, the <code>assignValue</code> function checks if <code>nullableVariable</code> is null. If it is null, the new value is assigned to <code>nullableVariable</code>.</p><p>Both approaches ensure that you can assign a new value to a nullable variable in Flutter while handling the null case appropriately.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-72909164427748644552023-05-24T20:50:00.001-07:002023-05-24T20:50:08.977-07:00Setting Status Bar from Action Hover Slot in PySide2/Qt 5<p>In PySide2/Qt 5, the status bar can be set from the action hover slot by accessing the main window or parent widget and then accessing its status bar. Here's an example of how you can achieve this:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>python</span></div></div></pre><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-python"><span class="hljs-keyword">from</span> PySide2.QtWidgets <span class="hljs-keyword">import</span> QApplication, QMainWindow, QAction
<span class="hljs-keyword">class</span> <span class="hljs-title class_">MainWindow</span>(<span class="hljs-title class_ inherited__">QMainWindow</span>):
<span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self</span>):
<span class="hljs-built_in">super</span>().__init__()
self.initUI()
<span class="hljs-keyword">def</span> <span class="hljs-title function_">initUI</span>(<span class="hljs-params">self</span>):
self.setWindowTitle(<span class="hljs-string">'Status Bar Example'</span>)
self.statusBar().showMessage(<span class="hljs-string">'Ready'</span>)
action = QAction(<span class="hljs-string">'Hover Action'</span>, self)
action.setShortcut(<span class="hljs-string">'Ctrl+H'</span>)
action.setStatusTip(<span class="hljs-string">'Hover over this action'</span>)
action.triggered.connect(self.hoverAction)
self.toolbar = self.addToolBar(<span class="hljs-string">'Toolbar'</span>)
self.toolbar.addAction(action)
<span class="hljs-keyword">def</span> <span class="hljs-title function_">hoverAction</span>(<span class="hljs-params">self</span>):
self.statusBar().showMessage(<span class="hljs-string">'Action is being hovered'</span>)
<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">'__main__'</span>:
app = QApplication([])
window = MainWindow()
window.show()
app.exec_()
</code></div></div></pre><p>In this example, we create a <code>MainWindow</code> class that inherits from <code>QMainWindow</code>. Inside the <code>initUI</code> method, we set up the main window with a status bar and a toolbar. The <code>hoverAction</code> method is connected to the triggered signal of the hover action, and when the action is triggered, it sets the message in the status bar to "Action is being hovered".</p><p>You can run this code and see that when you hover over the action in the toolbar and trigger it (e.g., by clicking on it or pressing the associated shortcut), the status bar message will change to reflect the hover action.</p><p>Make sure you have PySide2 installed (<code>pip install PySide2</code>) and run the code with an appropriate Python interpreter to see the application in action.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-5417100734221317072023-05-24T20:47:00.003-07:002023-05-24T20:47:19.097-07:00Troubleshooting Missing Calendar Icon in Angular Kendo UI Component<p> If the calendar icon is not showing in an Angular Kendo UI component, it could be due to a few possible reasons. Here are some steps you can take to troubleshoot and resolve the issue:</p><ol><li><p>Check the Icon Library: Ensure that you have included the required icon library for Kendo UI in your project. Kendo UI relies on a specific icon font or icon library for displaying icons. By default, Kendo UI for Angular uses the Font Awesome icons.</p><p>In your project, make sure you have included the necessary CSS file or CDN for the icon library. For Font Awesome, you can add the following link to your HTML file:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>html</span></div></div></pre></li></ol><div class="markdown prose w-full break-words dark:prose-invert light"><li><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-html"><span class="hljs-tag"><<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"</span>></span>
</code></div></div></pre><p>If you are using a different icon library, make sure to include the appropriate CSS file or CDN.</p></li><li><p>Verify Font Icon Integration: Confirm that you have integrated the font icons correctly within your Angular application. Depending on your build setup, you may need to configure your build process to copy the required font files to the appropriate location.</p><p>For example, if you are using the Angular CLI, you can add the necessary font files to the "assets" folder in your project and ensure that the files are included in the "assets" section of the <code>angular.json</code> file.</p></li><li><p>Check for Custom Styling: If you have applied custom styles or overridden the default styles for the Kendo UI component, it's possible that your styles are affecting the visibility of the calendar icon. Review your custom CSS styles and make sure they are not conflicting with the icon display.</p></li><li><p>Verify Kendo UI Component Configuration: Double-check the configuration options for the specific Kendo UI component you are using. Ensure that you have set the appropriate options for displaying the calendar icon.</p><p>For example, if you are using the Kendo UI DatePicker component, make sure that the <code>showIcon</code> property is set to <code>true</code>:</p><pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>html</span></div></div></pre></li><ol><li value="4"><pre><div class="bg-black rounded-md mb-4"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-html"><span class="hljs-tag"><<span class="hljs-name">kendo-datepicker</span> <span class="hljs-attr">showIcon</span>=<span class="hljs-string">"true"</span>></span><span class="hljs-tag"></<span class="hljs-name">kendo-datepicker</span>></span>
</code></div></div></pre><p>Adjust the configuration options according to the specific Kendo UI component you are using.</p></li><li><p>Clear Browser Cache: Clear your browser cache and refresh the page. Sometimes, cached resources can interfere with the loading of new or updated icons.</p></li><li><p>Update Kendo UI Version: If you are using an older version of Kendo UI, there might be compatibility issues with newer versions of icon libraries or Angular itself. Consider updating your Kendo UI package to the latest version to ensure compatibility with the dependencies.</p></li></ol><p>By following these steps, you should be able to identify and resolve the issue with the calendar icon not showing in your Angular Kendo UI component.</p></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-40612315672500224302023-02-27T22:40:00.002-08:002023-02-27T22:40:11.294-08:008 Essential CSS Tips Every Web Developer Must Know<p></p><ol><li><p>Use CSS Resets or Normalize: Different browsers have different default styles for HTML elements. Using a CSS reset or normalize can help ensure consistency across different browsers and prevent unexpected styling issues.</p></li><li><p>Keep Selectors Specific: Avoid using general selectors like tag names or universal selectors unless necessary. Be as specific as possible to avoid unintended styling conflicts.</p></li><li><p>Use Box Sizing Border Box: By setting the box-sizing property to border-box, the padding and border of an element will be included in its total width and height. This can make it easier to calculate and control the size of elements.</p></li><li><p>Use CSS Grid and Flexbox: CSS Grid and Flexbox are powerful layout tools that can simplify the process of creating complex layouts. They offer a more flexible and responsive way to position and align content on a web page.</p></li><li><p>Use Media Queries for Responsive Design: Media queries allow you to adjust the styling of your website based on the device's screen size. This can help make your website more accessible and user-friendly on different devices.</p></li><li><p>Avoid Using Inline Styles: Inline styles can make it difficult to maintain and update the styling of a website. It's better to keep styling in a separate stylesheet to ensure consistency and ease of maintenance.</p></li><li><p>Keep CSS Organized: Organizing CSS into separate files and using comments can make it easier to maintain and update the styling of a website.</p></li><li><p>Use CSS Preprocessors: CSS preprocessors like Sass or Less can make writing CSS more efficient and maintainable. They offer features like variables, nesting, and mixins that can simplify the process of writing and updating CSS.</p></li></ol>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-66439906089293135912023-02-26T21:25:00.006-08:002023-02-26T21:25:54.309-08:00New Features in Bootstrap 5.3.0-alpha1: Improved Form Validation, Updated Utilities, and More<p> </p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><p>Bootstrap 5.3.0-alpha1 is the latest alpha version of Bootstrap 5 as of my knowledge cutoff in September 2021. Here are some of the features that were included in this alpha release:</p><ol><li><p>New <code>container-xl</code> class: This new container class allows for full-width content on extra-large screens, and is larger than the <code>container-lg</code> class.</p></li><li><p>New <code>row-cols-*</code> classes: These classes allow for easy customization of the number of columns in a row for different screen sizes.</p></li><li><p>Improved form validation styling: Bootstrap 5.3.0-alpha1 includes improved form validation styles and new form validation events to make it easier to provide feedback to users when they submit a form.</p></li><li><p>Updated utility classes: The utility classes in Bootstrap 5.3.0-alpha1 have been updated to include new spacing classes, as well as updated typography and color classes.</p></li><li><p>New responsive <code>text-wrap</code> utility class: This new class allows you to control how text wraps within a container, making it easier to create responsive designs.</p></li><li><p>New <code>offcanvas-body</code> class: This class allows you to create a scrollable body area for off-canvas content, making it easier to create responsive off-canvas menus and panels.</p></li><li><p>Improved accessibility: Bootstrap 5.3.0-alpha1 includes improved accessibility features, such as better support for screen readers and improved keyboard navigation.</p></li><li><p>Updated documentation: The Bootstrap documentation has been updated to include new examples and improved organization, making it easier to find the information you need.</p></li></ol><p>It's worth noting that since Bootstrap 5.3.0-alpha1 is an alpha release, it may not be stable enough for production use. It's always a good idea to test any new version thoroughly before using it on a production site.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-5087350937380099662023-02-23T21:22:00.000-08:002023-02-23T21:22:52.171-08:00Generative AI in the design process<p> </p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><p>Generative AI can be a powerful tool in the design process, as it has the ability to create novel designs based on specified parameters and constraints. By using generative AI, designers can generate a large number of design options quickly and efficiently, which can help them to explore and evaluate a wide range of design alternatives.</p><p>Generative AI can be used in a variety of design fields, including architecture, industrial design, fashion design, graphic design, and more. In architecture, for example, generative AI can be used to generate building designs that meet specific requirements such as site conditions, building codes, and user needs. In fashion design, generative AI can be used to create custom clothing designs based on user preferences and body measurements.</p><p>One of the benefits of using generative AI in the design process is that it can help designers to discover new design solutions that they may not have considered otherwise. By exploring a wide range of design options, designers can gain new insights and ideas, and potentially arrive at more innovative and creative solutions.</p><p>However, it is important to note that generative AI should be used as a tool to assist designers, rather than replace them. Design is a complex process that involves a range of factors, including aesthetics, functionality, user needs, and cultural context, and AI is not yet capable of fully understanding and replicating these factors. Therefore, designers should use their expertise and judgement to evaluate and refine the generated designs, and ensure that they meet the desired criteria.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-77473988781915368342023-02-22T23:25:00.002-08:002023-02-23T21:21:14.217-08:00 10 essential HTML tags that every beginner needs to know.<p><span style="font-family: verdana;"> HTML (Hypertext Markup Language) is the foundation of every website on the internet. It is the language that web developers use to create web pages and make them functional. HTML tags are the building blocks of a web page, and without them, a web page cannot exist. In this article, we will discuss 10 essential HTML tags that every beginner needs to know.</span></p><ol><li><span style="font-family: verdana;"><!DOCTYPE html></span></li></ol><p><span style="font-family: verdana;">This tag is not technically an HTML tag, but it is still an essential element of any web page. The <!DOCTYPE html> tag specifies the version of HTML that the web page is using. It is the first tag in any HTML document.</span></p><ol start="2"><li><span style="font-family: verdana;"><html></span></li></ol><p><span style="font-family: verdana;">The <html> tag is the second tag in an HTML document. It defines the beginning and end of an HTML document. Every web page must have an opening <html> tag and a closing </html> tag.</span></p><ol start="3"><li><span style="font-family: verdana;"><head></span></li></ol><p><span style="font-family: verdana;">The <head> tag contains information about the web page, such as the title of the page, the author of the page, and keywords that describe the content of the page. This tag does not display any content on the web page.</span></p><ol start="4"><li><span style="font-family: verdana;"><title></span></li></ol><p><span style="font-family: verdana;">The <title> tag is used to define the title of the web page. The title is displayed in the browser's title bar and is also used by search engines to display the title of the web page in search results.</span></p><ol start="5"><li><span style="font-family: verdana;"><body></span></li></ol><p><span style="font-family: verdana;">The <body> tag is used to define the content of the web page. This is where all of the text, images, and other elements of the web page are displayed.</span></p><ol start="6"><li><span style="font-family: verdana;"><h1> - <h6></span></li></ol><p><span style="font-family: verdana;">The <h1> - <h6> tags are used to define headings on the web page. The <h1> tag is used for the main heading of the page, while the <h2> - <h6> tags are used for subheadings.</span></p><ol start="7"><li><span style="font-family: verdana;"><p></span></li></ol><p><span style="font-family: verdana;">The <p> tag is used to define paragraphs on the web page. This tag is used to separate blocks of text and make the content easier to read.</span></p><ol start="8"><li><span style="font-family: verdana;"><a></span></li></ol><p><span style="font-family: verdana;">The <a> tag is used to create hyperlinks on the web page. This tag is used to link to other web pages, images, or files.</span></p><ol start="9"><li><span style="font-family: verdana;"><img></span></li></ol><p><span style="font-family: verdana;">The <img> tag is used to display images on the web page. This tag requires a source attribute that specifies the location of the image file.</span></p><ol start="10"><li><span style="font-family: verdana;"><ul> and <li></span></li></ol><p><span style="font-family: verdana;">The <ul> tag is used to create an unordered list on the web page, while the <li> tag is used to define the items in the list.</span></p><p><span style="font-family: verdana;">In conclusion, these 10 essential HTML tags are the building blocks of every web page. As a beginner, it's important to understand these tags and how to use them correctly. Once you have a good understanding of these tags, you can begin to explore more advanced HTML tags and create more complex web pages.</span></p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-23843385744523987772023-02-21T20:03:00.006-08:002023-02-21T20:04:48.789-08:00Essential Skills for a Successful UI Designer<p> As a UI (User Interface) designer, there are several skills that are essential to master in order to be successful in the field. Here are some of the most important skills for a UI designer:</p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><ol><li><p>Design tools proficiency: A UI designer should be proficient in using design tools such as Adobe Photoshop, Illustrator, Sketch, Figma, and other relevant tools to create mockups, wireframes, and other visual designs.</p></li><li><p>Knowledge of design principles: A UI designer should have a strong understanding of design principles, such as color theory, typography, layout, and visual hierarchy. Understanding how to apply these principles to create effective designs is crucial.</p></li><li><p>User research and analysis: A UI designer should be able to conduct user research to gain insights into the needs and behaviors of users, and use that information to create designs that meet those needs.</p></li><li><p>Understanding of UX (User Experience) principles: A UI designer should have a good understanding of UX principles, such as usability, accessibility, and user flow, to create designs that are not only visually appealing but also user-friendly.</p></li><li><p>Collaboration and communication skills: A UI designer should be able to effectively communicate and collaborate with other team members, including developers, project managers, and other designers, to ensure that designs are implemented correctly.</p></li><li><p>Problem-solving skills: A UI designer should be able to identify and solve design problems, whether they are related to usability, accessibility, or other design issues.</p></li><li><p>Attention to detail: A UI designer should be able to pay close attention to details, such as pixel-perfect designs and ensuring that designs are consistent across different platforms and devices.</p></li><li><p>Keeping up-to-date with design trends and technology: A UI designer should be up-to-date with the latest design trends and emerging technologies, in order to stay relevant and competitive in the field.</p></li></ol></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-91446096103250121602023-02-20T23:15:00.001-08:002023-02-20T23:15:02.018-08:00Modern CSS in Angular: Layouts<p> Angular provides various ways to create and manage layouts using modern CSS techniques. Here are some of the commonly used techniques to create layouts in Angular:</p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><ol><li><p>CSS Grid Layout: CSS Grid is a powerful layout system that enables you to create complex layouts with ease. It allows you to divide a page into columns and rows and position elements within them. You can use the <code>display: grid</code> property to enable CSS Grid and define the grid using the <code>grid-template-columns</code> and <code>grid-template-rows</code> properties. You can also use the <code>grid-column</code> and <code>grid-row</code> properties to position items within the grid.</p></li><li><p>Flexbox Layout: Flexbox is another modern CSS layout technique that is widely used. It is a one-dimensional layout system that is useful for creating responsive and dynamic layouts. You can use the <code>display: flex</code> property to enable Flexbox and define the flex items using the <code>flex</code> property. You can also use other properties like <code>justify-content</code> and <code>align-items</code> to align and distribute the flex items.</p></li><li><p>CSS Variables: CSS Variables allow you to define reusable values that can be used throughout your CSS code. You can define a variable using the <code>--variable-name</code> syntax and access it using the <code>var()</code> function. This makes it easy to create consistent styles and layouts across your application.</p></li><li><p>Media Queries: Media Queries allow you to apply different styles based on the size of the screen or the device being used. You can use the <code>@media</code> rule to define a media query and specify the styles that should be applied. This is useful for creating responsive layouts that work well on different devices.</p></li></ol><p>In Angular, you can use these modern CSS techniques to create layouts in your templates or component styles. You can also use CSS frameworks like Bootstrap or Material Design to build responsive and consistent layouts quickly.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-41603658631290087712023-02-19T23:00:00.000-08:002023-02-19T23:00:08.640-08:00Advancements in the Angular Router <p>The Angular Router is a powerful tool that enables developers to create complex, single-page web applications with multiple views and navigation capabilities. Over the years, there have been several advancements in the Angular Router, some of which include:</p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><ol><li><p>Lazy loading of modules: This feature allows developers to load parts of the application only when they are needed, rather than loading the entire application upfront. This results in faster load times and better performance.</p></li><li><p>Guards: Guards are functions that determine whether or not a user is allowed to navigate to a particular route. There are several types of guards, including canActivate, canActivateChild, canDeactivate, and canLoad.</p></li><li><p>Navigation events: The Angular Router emits a series of events as the user navigates through the application. Developers can subscribe to these events and perform certain actions when they occur, such as displaying a loading spinner.</p></li><li><p>Route resolvers: Route resolvers are functions that are executed before a route is activated. They can be used to fetch data that the route depends on, and ensure that the data is available before the route is displayed.</p></li><li><p>Optional parameters: The Angular Router supports optional parameters, which allows developers to define routes with optional parts. This can be useful for creating more flexible and dynamic routes.</p></li><li><p>Route reuse strategy: This feature enables developers to reuse routes instead of destroying and recreating them every time the user navigates. This can result in significant performance improvements, particularly for complex applications with large numbers of views.</p></li></ol><p>Overall, the Angular Router continues to evolve and improve, providing developers with more tools and capabilities to build complex, dynamic web applications.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-60254726321267393292023-02-19T22:49:00.004-08:002023-02-19T23:01:09.578-08:005 Best WordPress Backup Plugins to Keep Your Data Safe and Sound<p> </p><div class="flex flex-grow flex-col gap-3"><div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap"><div class="markdown prose w-full break-words dark:prose-invert light"><p>WordPress is a powerful platform for building websites and blogs, but it's not immune to data loss or corruption. That's why it's important to have a backup solution in place to protect your website's data in case of any issues. Here are the 5 best WordPress backup plugins to keep your data safe and sound:</p><ol><li><p>UpdraftPlus - UpdraftPlus is one of the most popular backup plugins for WordPress, with over 2 million active installs. It allows you to schedule automatic backups and store them on remote storage services like Dropbox, Google Drive, or Amazon S3. It also offers one-click restoration and a migration feature that makes it easy to move your website to a new host.</p></li><li><p>Jetpack Backup - Jetpack Backup is a premium backup service offered by Jetpack, one of the most popular WordPress plugins. It offers real-time backups with one-click restores, and you can store your backups on their secure servers. It also includes malware scanning and automated security fixes to keep your site secure.</p></li><li><p>BackupBuddy - BackupBuddy is a popular backup plugin for WordPress, with over 500,000 active installs. It offers scheduled backups, automatic restoration, and the ability to store backups on remote storage services like Dropbox, Google Drive, or Amazon S3. It also includes a migration feature that makes it easy to move your website to a new host.</p></li><li><p>VaultPress - VaultPress is a backup and security service offered by Automattic, the company behind WordPress. It offers real-time backups and restores, with backups stored on their secure servers. It also includes automated security scans and fixes to keep your site secure.</p></li><li><p>Duplicator - Duplicator is a backup and migration plugin for WordPress, with over 1 million active installs. It allows you to create backups of your website and move them to a new host. It also includes a feature to create a staging site for testing changes before making them live on your website.</p></li></ol><p>No matter which backup plugin you choose, it's important to have a reliable backup solution in place to protect your website's data. Make sure to regularly backup your website and store your backups in a safe and secure location.</p></div></div></div>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-1840787754181814902023-02-16T20:18:00.001-08:002023-02-16T20:18:56.733-08:00Creating a dynamic list from Angular<p> </p><p>In Angular, you can create a dynamic list using the <code>*ngFor</code> directive. The <code>*ngFor</code> directive is used to loop through an array and generate a list of elements based on the data in the array.</p><p>Here's an example of how to create a dynamic list in Angular:</p><p> </p><p>:</p><ol><li>Create an array of items in your component:</li></ol><pre><div class="bg-black mb-4 rounded-md"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans"><span class="">css</span></div></div></pre><pre><div class="bg-black mb-4 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-css">items = <span class="hljs-selector-attr">[<span class="hljs-string">'Item 1'</span>, <span class="hljs-string">'Item 2'</span>, <span class="hljs-string">'Item 3'</span>]</span>;
</code></div></div></pre><ol start="2"><li>In your component's HTML template, use the <code>*ngFor</code> directive to loop through the array and generate a list of items:</li></ol><pre><div class="bg-black mb-4 rounded-md"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans"><span class="">php</span></div></div></pre><pre><div class="bg-black mb-4 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-php-template"><span class="xml"><span class="hljs-tag"><<span class="hljs-name">ul</span>></span>
<span class="hljs-tag"><<span class="hljs-name">li</span> *<span class="hljs-attr">ngFor</span>=<span class="hljs-string">"let item of items"</span>></span>{{ item }}<span class="hljs-tag"></<span class="hljs-name">li</span>></span>
<span class="hljs-tag"></<span class="hljs-name">ul</span>></span>
</span></code></div></div></pre><p>This will generate an unordered list with three items, each with the text "Item 1", "Item 2", or "Item 3", respectively.</p><p>You can also use <code>*ngFor</code> with an object to loop through the object's properties. Here's an example:</p><ol><li>Create an object with properties in your component:</li></ol><pre><div class="bg-black mb-4 rounded-md"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans"><span class="">css</span></div></div></pre><pre><div class="bg-black mb-4 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-css">items = { item1: <span class="hljs-string">'Item 1'</span>, item2: <span class="hljs-string">'Item 2'</span>, item3: <span class="hljs-string">'Item 3'</span> };
</code></div></div></pre><ol start="2"><li>In your component's HTML template, use the <code>*ngFor</code> directive to loop through the object and generate a list of items:</li></ol><pre><div class="bg-black mb-4 rounded-md"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans"><span class="">css</span></div></div></pre><pre><div class="bg-black mb-4 rounded-md"><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-css"><<span class="hljs-selector-tag">ul</span>>
<<span class="hljs-selector-tag">li</span> *ngFor="let item of <span class="hljs-selector-tag">Object</span><span class="hljs-selector-class">.keys</span>(items)">{{ items<span class="hljs-selector-attr">[item]</span> }}</<span class="hljs-selector-tag">li</span>>
</<span class="hljs-selector-tag">ul</span>>
</code></div></div></pre><p>This will generate an unordered list with three items, each with the text "Item 1", "Item 2", or "Item 3", respectively, based on the properties in the <code>items</code> object.</p><p> </p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-56321964365297294732023-02-15T23:05:00.000-08:002023-02-15T23:05:22.707-08:00The Importance of Converting PSD to HTML<p> In today's digital world, having a strong online presence is crucial for the success of any business. A well-designed website can make a significant impact on your business and help you reach your goals. When designing a website, it's essential to consider both the design and functionality. This is where PSD to HTML conversion comes in.</p><p>PSD to HTML conversion is the process of converting a Photoshop Document (PSD) into a functional HTML web page. It involves taking a design created in Photoshop and converting it into a web page that can be viewed on the internet. This conversion process is crucial because it ensures that the website is functional, responsive, and accessible across different devices.</p><p>Here are some reasons why PSD to HTML conversion is important:</p><ol><li><p>Improves website functionality: PSD to HTML conversion helps to improve the functionality of the website. The conversion process involves writing clean, error-free code that ensures the website is fast, reliable, and easy to use. It also ensures that the website is compatible with all major browsers, including Google Chrome, Safari, Mozilla Firefox, and Microsoft Edge.</p></li><li><p>Enhances website performance: The performance of a website is a critical factor that affects user experience and website rankings. PSD to HTML conversion ensures that the website is optimized for speed and performance. This means that the website loads faster, which improves the user experience and reduces bounce rates.</p></li><li><p>Provides a responsive design: In today's world, most people access the internet using their smartphones or tablets. Therefore, it's essential to ensure that your website is responsive and accessible across all devices. PSD to HTML conversion ensures that the website is responsive, meaning it adjusts to fit the screen size of different devices, providing an optimal viewing experience.</p></li><li><p>Increases website accessibility: Website accessibility is crucial for users with disabilities. PSD to HTML conversion ensures that the website is accessible to everyone, including those with disabilities. The conversion process involves adding alt tags to images, providing descriptive text for non-text content, and ensuring that the website is navigable using a keyboard.</p></li><li><p>Boosts SEO: Search engine optimization (SEO) is critical for the success of any website. PSD to HTML conversion ensures that the website is SEO friendly. This means that the website is structured in a way that search engines can crawl and index it easily. This helps to improve the website's search engine rankings and drive more traffic to the website.</p></li></ol><p>In conclusion, PSD to HTML conversion is essential for the success of any website. It ensures that the website is functional, responsive, and accessible across different devices. It also improves the website's performance, accessibility, and search engine rankings. Therefore, it's crucial to hire a professional web developer to handle the PSD to HTML conversion process for your website.</p>Rageshhttp://www.blogger.com/profile/00127816602725456068noreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-30351847965593085742016-03-30T23:39:00.003-07:002016-03-30T23:39:47.129-07:00:nth-of-type<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
The <code>:nth-of-type</code> selector allows you select one or more elements based on their source order, according to a formula. It is defined in the <a href="http://www.w3.org/TR/selectors/">CSS Selectors Level 3 spec</a> as a “structural pseudo-class”, meaning it is used to style content based on its relationship with parent and sibling elements.<br />
Suppose we have an unordered list and wish to “zebra-stripe” alternating list items:<br />
<br />
<pre class=" language-markup" rel="HTML"><code class=" language-markup"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>First Item<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>Second Item<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>Third Item<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>Fourth Item<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>Fifth Item<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
</div>
<pre class=" language-css" rel="CSS"><code class=" language-css"><span class="token selector">li </span><span class="token punctuation">{</span>
<span class="token property">background</span><span class="token punctuation">:</span> slategrey<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment" spellcheck="true">/* select alternating items starting with the second item */</span>
<span class="token selector">li<span class="token pseudo-class">:nth-of-type(2n)</span> </span><span class="token punctuation">{</span>
<span class="token property">background</span><span class="token punctuation">:</span> lightslategrey<span class="token punctuation">;</span>
<span class="token punctuation">}</span></code></pre>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8887342951816253003.post-62648390371655117012016-03-29T23:38:00.000-07:002016-03-29T23:38:10.529-07:00What's the difference between "clear: both;" and clearfix?<div dir="ltr" style="text-align: left;" trbidi="on">
<code><code>clear: both;</code> is used to make an element appear below any floated elements that are above it. So given the following HTML, the <code></code> would appear below the <code><img /></code>:</code><br />
<br />
<br />
<pre class="prettyprint"><code><span class="tag"><img</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">"foo.jpg"</span><span class="pln"> </span><span class="atn">style</span><span class="pun">=</span><span class="atv">"</span><span class="kwd">float</span><span class="pun">:</span><span class="pln"> right</span><span class="atv">"</span><span class="tag">></span><span class="pln">
</span><span class="tag"><p</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"clear: both;"</span><span class="tag">></span><span class="pln">Things and stuff</span><span class="tag"></p></span><span class="pln">
</span></code></pre>
<br />
Note: You can usually achieve the same effect as <code>.clearfix</code> with less code by using <a href="http://www.sitepoint.com/blogs/2005/02/26/simple-clearing-of-floats/">the <code>overflow: hidden;</code> method</a> (although <a href="http://aloestudios.com/2009/12/goodbye-overflow-clearing-hack/">it has it's own issues</a>). Alternatively, float the element you'd apply <code>.clearfix</code> to (although that comes with it's own issues, too).<br />
<code>.clearfix</code> is designed to make an element expand to enclose any floated elements within it. So, in the following example, the <code></code><br />
<div>
</div>
<code>
</code> would expand vertically to fit the content inside it:<br />
<br />
<br />
<br />
<code>clear:both</code> can be applied to any block-level element (a
div is frequently used), but sometimes this involves adding non-semantic
mark-up into the document just for the purpose of clearing a float.<br />
The clearfix technique is a way of clearing the float without having
to add non-semantic elements. Older browsers however, such as IE6 and
IE7, do not support the clearfix technique<br />
<code>clear:both</code> is always enough when applied to a
block-level element that appears after a float, the issue is adding the
extra mark-up for it - your document can end up with many extra elements
that are just there to clear floats...</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-24773404091456735792016-02-23T02:38:00.001-08:002016-02-23T02:38:21.553-08:00CSS stacking with display:table<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaEUnHhv87kTs6MrAgO_KTeAsA4pe5qKND-fKBXhDGvqr0C8e3vBBzyDTaqeewpQbUnDE5gX-pEEiu2OmlPjSk7kf-18Wjn5GZ5D0vE4qsghkUjRiQtDipWvqqrJvS-8TYkYtSQ7VNYqo/s1600/css-table-cell-03-eyecatch.png.pagespeed.ce.S3P4SJiGOh.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaEUnHhv87kTs6MrAgO_KTeAsA4pe5qKND-fKBXhDGvqr0C8e3vBBzyDTaqeewpQbUnDE5gX-pEEiu2OmlPjSk7kf-18Wjn5GZ5D0vE4qsghkUjRiQtDipWvqqrJvS-8TYkYtSQ7VNYqo/s320/css-table-cell-03-eyecatch.png.pagespeed.ce.S3P4SJiGOh.png" width="320" /></a></div>
<div>
With responsive design, one of the things that we often want to do is to change the stack order of certain elements, moving the aside on the left below the main text which we want to bring to the top. CSS3‘s Flexbox will do this for us, but there is a quicker, if dirtier, way which we can use now.</div>
<div>
<br /></div>
<div>
I say “use now” when of course we can use Flexbox now but implementations vary across browsers as does the required syntax. Opera’s Chris Mills has written two excellent in-depth articles (Flexbox basics and Advanced cross-browser flexbox) on the different flavours of Flexbox.</div>
<div>
<br /></div>
<div>
<div>
Flexbox will of course offer more than simple re-stacking of elements, but if that is all you need, you can look no further than CSS‘s display property.</div>
<div>
<br /></div>
<div>
(Incidentally this idea is based on something Bruce Lawson told us at beyond tellerrand 2012)</div>
<div>
<br /></div>
<div>
Let’s take four boxes whose very simple HTML is laid out as follows:</div>
<div>
<div class="boxes">
</div>
<div>
<div class="one box">
Box One</div>
</div>
<div>
<div class="two box">
Box Two</div>
</div>
<div>
<div class="three box">
Box Three</div>
</div>
<div>
<div class="four box">
Box Four</div>
</div>
<div>
</div>
</div>
<div>
And whose styling is equally as simple:</div>
<div>
.boxes { </div>
<div>
width:50%; </div>
<div>
margin:0 auto; </div>
<div>
} </div>
<div>
.box { </div>
<div>
display:inline-block; </div>
<div>
width:24%; </div>
<div>
height:15em; </div>
<div>
text-align:center; </div>
<div>
line-height:15em; </div>
<div>
color:#fff; </div>
<div>
} </div>
<div>
.one { background:#333; } </div>
<div>
.two { </div>
<div>
background:#fff; </div>
<div>
color:#333; </div>
<div>
} </div>
<div>
.three { background:#aaa; } </div>
<div>
.four { background:#dc002e; }</div>
<div>
We can easily change the ordering of these boxes in a media query, say at 48em (768px) by taking advantage of display:table. For demo purposes, we’ll put box three at the top, followed by box four, two and then one.</div>
<div>
<br /></div>
<div>
First of all we need to set the containing element, .boxes as display:table.</div>
<div>
<br /></div>
<div>
Then we set the element we want at the top, Box Three, as display:table-caption.</div>
<div>
<br /></div>
<div>
To push an element to the bottom, in this case Box One, we set display:table-footer-group.</div>
<div>
<br /></div>
<div>
And finally to push an element to the top, but not the very top we set Box Four to display:table-header-group.</div>
<div>
/* 768px */ </div>
<div>
@media only screen and (max-width:48em) { </div>
<div>
.boxes { </div>
<div>
display:table; </div>
<div>
width:100%; </div>
<div>
} </div>
<div>
.box { </div>
<div>
display:block; </div>
<div>
width:100%; </div>
<div>
} </div>
<div>
.three { display:table-caption; } </div>
<div>
.four { display:table-header-group; } </div>
<div>
.one { display:table-footer-group; } </div>
<div>
}</div>
<div>
You can see this simple demo in action if you resize your browser.</div>
<div>
<br /></div>
<div>
Now I know that purists will probably be appalled by this, I know that I am a bit, but I will admit to having used it in production code simply because it works and it’s a lot less hassle than the various incarnations of Flexbox at the moment. It also works cross browser down to and including Internet Explorer 8.</div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-80374225073955860722014-07-10T04:31:00.000-07:002014-07-10T04:34:38.238-07:00Slide two carousel sliders at a same time in Bootstrap <div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSxdvb4F21EP1Ke0io4s8XnDKCdeQpzGH7_5lsp90pv1QgRGjmhNOzb7ZX9OycRXXfbvFUm00ID2Icwb7vD8_To7OlCv8xmYnSmkA-Z8DCMYL2mjKfyYWzgbI2qEEIhe26VnMi54OmEhU/s1600/twitter-bootstrap.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSxdvb4F21EP1Ke0io4s8XnDKCdeQpzGH7_5lsp90pv1QgRGjmhNOzb7ZX9OycRXXfbvFUm00ID2Icwb7vD8_To7OlCv8xmYnSmkA-Z8DCMYL2mjKfyYWzgbI2qEEIhe26VnMi54OmEhU/s1600/twitter-bootstrap.jpg" height="236" width="400" /></a></div>
To avoid this delay, you could manually launch both carousels at the same time, and use customized treatments for events.<br />
<ul>
<li>Syncronized init</li>
<li>Simple launch events on both carousels</li>
<li>Pause on hover (I missed you didn't need it)</li>
</ul>
</div>
<pre class="default prettyprint prettyprinted"><code><span class="pln">$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">carousel</span><span class="pun">(</span><span class="str">'cycle'</span><span class="pun">);</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">on</span><span class="pun">(</span><span class="str">'click'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'.carousel-control[data-slide]'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">ev</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
ev</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">carousel</span><span class="pun">(</span><span class="pln">$</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">).</span><span class="pln">data</span><span class="pun">(</span><span class="str">'slide'</span><span class="pun">));</span><span class="pln">
</span><span class="pun">});</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">on</span><span class="pun">(</span><span class="str">'mouseover'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">ev</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
ev</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">carousel</span><span class="pun">(</span><span class="str">'pause'</span><span class="pun">);</span><span class="pln">
</span><span class="pun">});</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">on</span><span class="pun">(</span><span class="str">'mouseleave'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">ev</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
ev</span><span class="pun">.</span><span class="pln">preventDefault</span><span class="pun">();</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'.carousel-sync'</span><span class="pun">).</span><span class="pln">carousel</span><span class="pun">(</span><span class="str">'cycle'</span><span class="pun">);</span><span class="pln">
</span><span class="pun">});</span></code></pre>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8887342951816253003.post-76561453174034470972014-07-10T03:37:00.002-07:002014-07-10T04:34:06.762-07:00Creating JavaScript Sliders Using Twitter Bootstrap 3<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJrpq9NWrLqBeE5AnsEccZ_uf-Gf2LBJHzeaojJ6p89doHWRkgb1qsxzRo_tGZNLCCgjAav3z1NVzjCcGogs6gvKUCvMljOSF4s0JzpdTcZrFDnK9Mg-gqjyzEO1P_z05AEiC3Jh5sHE/s1600/twitter-bootstrap.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGJrpq9NWrLqBeE5AnsEccZ_uf-Gf2LBJHzeaojJ6p89doHWRkgb1qsxzRo_tGZNLCCgjAav3z1NVzjCcGogs6gvKUCvMljOSF4s0JzpdTcZrFDnK9Mg-gqjyzEO1P_z05AEiC3Jh5sHE/s1600/twitter-bootstrap.jpg" height="179" width="320" /></a></div>
Twitter Bootstrap 3 is one of the best CSS frameworks for developing
and designing content management systems. It is easy to design blogs,
portfolios and profiles using Twitter Bootstrap’s grid layouts. One
thing that many types of CMS have in common is the “Slider”. A
sequential automated display of images, a slider can be anything:
showcasing your latest projects, showing off your client’s assets,
describing special offers, linking to news items, or highlighting your
latest blog posts. <br />
<br />
In this article, we will learn how to create a JavaScript slider using Twitter Bootstrap 3’s Carousel Component.<br />
<h2>
Understanding Twitter Bootstrap 3 Carousel Component</h2>
The markup for the Carousel Component goes as follows:<br />
<div>
<div class="syntaxhighlighter xml" id="highlighter_659470">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
<div class="line number6 index5 alt1">
6</div>
<div class="line number7 index6 alt2">
7</div>
<div class="line number8 index7 alt1">
8</div>
<div class="line number9 index8 alt2">
9</div>
<div class="line number10 index9 alt1">
10</div>
<div class="line number11 index10 alt2">
11</div>
<div class="line number12 index11 alt1">
12</div>
<div class="line number13 index12 alt2">
13</div>
<div class="line number14 index13 alt1">
14</div>
<div class="line number15 index14 alt2">
15</div>
<div class="line number16 index15 alt1">
16</div>
<div class="line number17 index16 alt2">
17</div>
<div class="line number18 index17 alt1">
18</div>
<div class="line number19 index18 alt2">
19</div>
<div class="line number20 index19 alt1">
20</div>
<div class="line number21 index20 alt2">
21</div>
<div class="line number22 index21 alt1">
22</div>
<div class="line number23 index22 alt2">
23</div>
<div class="line number24 index23 alt1">
24</div>
<div class="line number25 index24 alt2">
25</div>
<div class="line number26 index25 alt1">
26</div>
<div class="line number27 index26 alt2">
27</div>
<div class="line number28 index27 alt1">
28</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">id</code><code class="xml plain">=</code><code class="xml string">"carousel-example-generic"</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel slide"</code> <code class="xml color1">data-ride</code><code class="xml plain">=</code><code class="xml string">"carousel"</code><code class="xml plain">></code></div>
<div class="line number2 index1 alt1">
</div>
<div class="line number3 index2 alt2">
<code class="xml spaces"> </code><code class="xml comments"><!-- Indicators --></code></div>
<div class="line number4 index3 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">ol</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-indicators"</code><code class="xml plain">></code></div>
<div class="line number5 index4 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"0"</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"active"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number6 index5 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"1"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number7 index6 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"2"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number8 index7 alt1">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">ol</code><code class="xml plain">></code></div>
<div class="line number9 index8 alt2">
</div>
<div class="line number10 index9 alt1">
<code class="xml spaces"> </code><code class="xml comments"><!-- Slider Content (Wrapper for slides )--></code></div>
<div class="line number11 index10 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-inner"</code><code class="xml plain">></code></div>
<div class="line number12 index11 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"item active"</code><code class="xml plain">></code></div>
<div class="line number13 index12 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">img</code> <code class="xml color1">src</code><code class="xml plain">=</code><code class="xml string">"..."</code> <code class="xml color1">alt</code><code class="xml plain">=</code><code class="xml string">"..."</code><code class="xml plain">></code></div>
<div class="line number14 index13 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-caption"</code><code class="xml plain">></code></div>
<div class="line number15 index14 alt2">
<code class="xml spaces"> </code><code class="xml plain">...</code></div>
<div class="line number16 index15 alt1">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
<div class="line number17 index16 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
<div class="line number18 index17 alt1">
<code class="xml spaces"> </code><code class="xml plain">...</code></div>
<div class="line number19 index18 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
<div class="line number20 index19 alt1">
</div>
<div class="line number21 index20 alt2">
<code class="xml spaces"> </code><code class="xml comments"><!-- Controls --></code></div>
<div class="line number22 index21 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">a</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"left carousel-control"</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide</code><code class="xml plain">=</code><code class="xml string">"prev"</code><code class="xml plain">></code></div>
<div class="line number23 index22 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"glyphicon glyphicon-chevron-left"</code><code class="xml plain">></</code><code class="xml keyword">span</code><code class="xml plain">></code></div>
<div class="line number24 index23 alt1">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">a</code><code class="xml plain">></code></div>
<div class="line number25 index24 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">a</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"right carousel-control"</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide</code><code class="xml plain">=</code><code class="xml string">"next"</code><code class="xml plain">></code></div>
<div class="line number26 index25 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"glyphicon glyphicon-chevron-right"</code><code class="xml plain">></</code><code class="xml keyword">span</code><code class="xml plain">></code></div>
<div class="line number27 index26 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">a</code><code class="xml plain">></code></div>
<div class="line number28 index27 alt1">
<code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
From the above code, we understand that Bootstrap 3 carousel is divided into three major sections:<br />
<ol>
<li>Indicators</li>
<li>Slider content</li>
<li>Controls</li>
</ol>
<br />
To set any div as the slider, we have to apply the classes <code>carousel</code> and <code>slide</code>. The <code>carousel</code> class defines the element as an element with a “merry-go-round” feature. The <code>slide</code> is applied to add the slide effect when the slider changes. <br />
<br />
<strong>Indicators</strong> are the small circles placed at the
bottom center of the slider to indicate the current slide position and
the number of sliders in total. Indicators are declared using an ordered
list.<br />
<div>
<div class="syntaxhighlighter xml" id="highlighter_354550">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="xml plain"><</code><code class="xml keyword">ol</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-indicators"</code><code class="xml plain">></code></div>
<div class="line number2 index1 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"0"</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"active"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number3 index2 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"1"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number4 index3 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">li</code> <code class="xml color1">data-target</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide-to</code><code class="xml plain">=</code><code class="xml string">"2"</code><code class="xml plain">></</code><code class="xml keyword">li</code><code class="xml plain">></code></div>
<div class="line number5 index4 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">ol</code><code class="xml plain">></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
The ordered list is given the class <code>carousel-indicators</code> to make the child elements look like small circles. Each <code>li</code> element must have a <code>data-target</code> attribute with the value as the id of the parent carousel div. They must also have a unique <code>data-slide-to</code> attribute with integer values as strings in an incremental order starting from “0”. <br />
<br />
<strong>Slider content</strong> is the main portion of the slider. It
is in this space we will place our slider’s content. The slider content
area is defined using the class <code>carousel-inner</code>. This div can again have unlimited <code>item</code> divs. The first <code>item</code> div must have an active class defined. <br />
<br />
<div>
<div class="syntaxhighlighter xml" id="highlighter_115623">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
<div class="line number6 index5 alt1">
6</div>
<div class="line number7 index6 alt2">
7</div>
<div class="line number8 index7 alt1">
8</div>
<div class="line number9 index8 alt2">
9</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-inner"</code><code class="xml plain">></code></div>
<div class="line number2 index1 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"item active"</code><code class="xml plain">></code></div>
<div class="line number3 index2 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">img</code> <code class="xml color1">src</code><code class="xml plain">=</code><code class="xml string">"..."</code> <code class="xml color1">alt</code><code class="xml plain">=</code><code class="xml string">"..."</code><code class="xml plain">></code></div>
<div class="line number4 index3 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">div</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"carousel-caption"</code><code class="xml plain">></code></div>
<div class="line number5 index4 alt2">
<code class="xml spaces"> </code><code class="xml plain">...</code></div>
<div class="line number6 index5 alt1">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
<div class="line number7 index6 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code></div>
<div class="line number8 index7 alt1">
<code class="xml spaces"> </code><code class="xml plain">...</code></div>
<div class="line number9 index8 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code><br />
<code class="xml plain"><br /></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
Each <code>item</code> div has two subsections: <code>image</code> and <code>carousel-caption</code>. The image is used as full width display content in the slider. The <code>carousel-caption</code> is placed floating over its respective image. You can place either an <code></code><br />
<h3>
<code>
</code></h3>
<code>
</code> element or a <code></code> element – or even both – inside the <code>carousel-caption</code>.<br />
<div>
<br />
<br />
<strong>Controls</strong> are the left and right arrow marks that are used to manually change the slider. <br />
<div>
<div class="syntaxhighlighter xml" id="highlighter_60141">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
<div class="line number6 index5 alt1">
6</div>
<div class="line number7 index6 alt2">
7</div>
<div class="line number8 index7 alt1">
8</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="xml comments"><!-- Controls --></code></div>
<div class="line number2 index1 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">a</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"left carousel-control"</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide</code><code class="xml plain">=</code><code class="xml string">"prev"</code><code class="xml plain">></code></div>
<div class="line number3 index2 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"glyphicon glyphicon-chevron-left"</code><code class="xml plain">></</code><code class="xml keyword">span</code><code class="xml plain">></code></div>
<div class="line number4 index3 alt1">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">a</code><code class="xml plain">></code></div>
<div class="line number5 index4 alt2">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">a</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"right carousel-control"</code> <code class="xml color1">href</code><code class="xml plain">=</code><code class="xml string">"#carousel-example-generic"</code> <code class="xml color1">data-slide</code><code class="xml plain">=</code><code class="xml string">"next"</code><code class="xml plain">></code></div>
<div class="line number6 index5 alt1">
<code class="xml spaces"> </code><code class="xml plain"><</code><code class="xml keyword">span</code> <code class="xml color1">class</code><code class="xml plain">=</code><code class="xml string">"glyphicon glyphicon-chevron-right"</code><code class="xml plain">></</code><code class="xml keyword">span</code><code class="xml plain">></code></div>
<div class="line number7 index6 alt2">
<code class="xml spaces"> </code><code class="xml plain"></</code><code class="xml keyword">a</code><code class="xml plain">></code></div>
<div class="line number8 index7 alt1">
<code class="xml plain"></</code><code class="xml keyword">div</code><code class="xml plain">></code><br />
<code class="xml plain"><br /></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
There should be two <code><a href="https://www.blogger.com/null"></a></code> elements: one for each arrow. The first <code><a href="https://www.blogger.com/null"></a></code> element will have a span with the <code>glyphicon glyphicon-chevron-left</code> class to show the left arrow, and the second <code><a href="https://www.blogger.com/null"></a></code> element will have <code>glyphicon glyphicon-chevron-right</code>
to show the right arrow. Since Bootstrap uses fonts instead of images
to show the icons, we have to follow glyphicon classes to show the
icons. <br />
That’s it! You have successfully created a slider for your website.
Plus, we didn’t write a single line of JavaScript to make it work.
bootstrap.js does things automatically for you. <br />
<h2>
Carousel Options</h2>
You can further customize the default functions of the slider by adding some more <code>data-*</code> attributes to the parent carousel div. <br />
<code>data-interval</code> is used to indicate the time gap between each slide. It takes a number as the value and the number represents milliseconds. <br />
<code>data-pause</code> is used to define when to pause the sliding
activity. If the value is “hover” it stops sliding when the mouse is
placed on the slider. <br />
<code>data-wrap</code> is a boolean attribute which tells whether or
not the slider should continue sliding from the beginning once the end
is reached. <br />
<h2>
For JQuery Geeks</h2>
Well, if you love using jQuery and <code>data-*</code> attributes are not your cup of tea, then Bootstrap allows you to initialize sliders using JavaScript, too!<br />
To make a carousel div work like a carousel, you have to write the following snippet:<br />
<div>
<div class="syntaxhighlighter jscript" id="highlighter_160109">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="jscript plain">$(</code><code class="jscript string">'.carousel'</code><code class="jscript plain">).carousel()</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
The Carousel options can then be set by passing a JSON object inside the carousel function. <br />
For example:<br />
<div>
<div class="syntaxhighlighter jscript" id="highlighter_320112">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="jscript plain">$(</code><code class="jscript string">'.carousel'</code><code class="jscript plain">).carousel({</code></div>
<div class="line number2 index1 alt1">
<code class="jscript spaces"> </code><code class="jscript plain">interval: 2000,</code></div>
<div class="line number3 index2 alt2">
<code class="jscript spaces"> </code><code class="jscript plain">pause: “hover”,</code></div>
<div class="line number4 index3 alt1">
<code class="jscript spaces"> </code><code class="jscript plain">wrap: </code><code class="jscript keyword">true</code></div>
<div class="line number5 index4 alt2">
<code class="jscript plain">})</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
You can also manually trigger slider events using snippets like the ones below:<br />
<div>
<div class="syntaxhighlighter jscript" id="highlighter_423244">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="gutter"><div class="line number1 index0 alt2">
1</div>
<div class="line number2 index1 alt1">
2</div>
<div class="line number3 index2 alt2">
3</div>
<div class="line number4 index3 alt1">
4</div>
<div class="line number5 index4 alt2">
5</div>
</td><td class="code"><div class="container">
<div class="line number1 index0 alt2">
<code class="jscript plain">.carousel(</code><code class="jscript string">'pause'</code><code class="jscript plain">) </code><code class="jscript comments">// to pause the slider</code></div>
<div class="line number2 index1 alt1">
<code class="jscript plain">.carousel(</code><code class="jscript string">'cycle'</code><code class="jscript plain">) </code><code class="jscript comments">// to cycle through the slider items</code></div>
<div class="line number3 index2 alt2">
<code class="jscript plain">.carousel(2) </code><code class="jscript comments">// to forcibly display the the 3rd slide in the slider</code></div>
<div class="line number4 index3 alt1">
<code class="jscript plain">.carousel(</code><code class="jscript string">'prev'</code><code class="jscript plain">) </code><code class="jscript comments">// to show the previous slide</code></div>
<div class="line number5 index4 alt2">
<code class="jscript plain">.carousel(‘next’) </code><code class="jscript comments">// to show the next slide in the slider</code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<br />
The above methods may be called from within any JavaScript code to manipulate the normal working of the slider. I do find the <code>prev</code> and <code>next</code>
methods very useful when I want to display my own buttons instead of
Bootstrap’s arrows. Especially when they are placed outside the
carousel’s parent div. </div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8887342951816253003.post-44856528596833331892014-07-03T21:36:00.001-07:002014-07-03T21:41:29.364-07:00SEO Benefits of Having a responsive web design for your business<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4WNKKZS-6r6QQU6L25GEFhwX2MbpM9d80GxcXd1zaogdb28VEQb0vJjXDpCTa90iEKZlp90tJJiY7Qv3yLBVeXLHJeHbn26jVCtgKBTkjxbCVi2SHURievPdwA-Z2-limzewNUG3TTLU/s1600/seo-responsive-website.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4WNKKZS-6r6QQU6L25GEFhwX2MbpM9d80GxcXd1zaogdb28VEQb0vJjXDpCTa90iEKZlp90tJJiY7Qv3yLBVeXLHJeHbn26jVCtgKBTkjxbCVi2SHURievPdwA-Z2-limzewNUG3TTLU/s1600/seo-responsive-website.png" height="197" width="320" /></a></div>
<span class="" id="result_box" lang="en"><span class="hps">The needs</span> <span class="hps">and requirements</span> <span class="hps">change over</span> <span class="hps">time.</span> <span class="hps">Companies are</span> <span class="hps">one of the first</span> <span class="hps">entities</span> <span class="hps">that have to</span> <span class="hps">redesign and improve</span> <span class="hps">their strategies</span> <span class="hps">continuously to meet</span> <span class="hps">the changing needs of</span> <span class="hps">its users</span> <span class="hps">and deploy</span> <span class="hps">the latest technology available</span> <span class="hps">in its</span> <span class="hps">marketing</span><span class="">, advertising</span> <span class="hps">and sales.</span> <span class="hps">Like</span> <span class="hps">today</span> <span class="hps">works best</span> <span class="hps">to ship goods</span> <span class="hps">by truck</span>, aircraft and ships, <span class="hps">and</span> <span class="hps">not through</span> <span class="hps">carts</span> <span class="hps">and</span> <span class="hps">buggies,</span> <span class="hps">work best</span> <span class="hps">when put into</span> <span class="hps">use</span> <span class="hps">the latest trends in</span> <span class="hps">website design</span> <span class="hps">and leave</span> <span class="hps">obsolete</span>. <span class="hps">The most important objective</span> <span class="hps">for websites</span> <span class="hps">is to satisfy</span> <span class="hps">visitors and</span> <span class="hps">keep them happy.</span> <br /><br /><span class="hps">Website design</span> <span class="hps">is the sensitivity of</span> <span class="hps">the answer to all</span> <span class="hps">the questions</span> <span class="hps">today</span>. <span class="hps">This is the</span> <span class="hps">type of</span> <span class="hps">website design</span> <span class="hps">that meets the</span> <span class="hps">customer requirements</span> <span class="hps">today</span> <span class="hps">and runs</span> <span class="hps">using the latest</span> <span class="hps">web design techniques</span> <span class="hps">in the best way</span>. <span class="hps">Here are some of</span> <span class="hps">the benefits of</span> <span class="hps">having a</span> <span class="hps">SEO</span> <span class="hps">website design</span> <span class="hps">response</span>.</span><br />
<span class="" lang="en"><br /></span>
<span class="" lang="en"><br /></span>
<span class="" lang="en"></span><br />
<div class="almost_half_cell" id="gt-res-content">
<div dir="ltr" style="zoom: 1;">
<span class="" id="result_box" lang="en"><span class="hps">Website Design</span> <span class="hps">Response</span> <span class="hps">and</span> <span class="hps">SEO</span> <span class="hps">benefits</span> <br /><br /><span class="hps">•</span> <span class="hps">The largest and</span> <span class="hps">most important</span> <span class="hps">goal</span> <span class="hps">for any website</span> <span class="hps">today is</span> <span class="hps">to impress</span> <span class="hps">Google</span> <span class="hps">because</span> <span class="hps">Google</span> <span class="hps">is the master of</span> <span class="hps">the</span> <span class="hps">online search.</span> <span class="hps">Admit</span> <span class="hps">it or not,</span> <span class="hps">Google</span> <span class="hps">loves and</span> <span class="hps">serves the</span> <span class="hps">website designs</span> <span class="hps">that match</span>. <span class="hps">With it,</span> <span class="hps">the</span> <span class="hps">web</span> <span class="hps">websites with</span> <span class="hps">responsive design</span> <span class="hps">at the top</span> <span class="hps">of</span> <span class="hps">their search results</span>. <span class="hps">It is because</span> <span class="hps">mobile devices</span> <span class="hps">have become common</span> <span class="hps">in the world and</span> <span class="hps">high percentage of</span> <span class="hps">all</span> <span class="hps">business conducted</span> <span class="hps">online is done</span> <span class="hps">through these</span> <span class="hps">mobile devices.</span> <span class="hps">Google</span> <span class="hps">knows</span> <span class="hps">when a</span> <span class="hps">mobile</span> <span class="hps">optimized</span> <span class="hps">website is</span> <span class="hps">and</span> <span class="hps">what</span> <span class="hps">counts as</span> <span class="hps">a plus</span>. <br /><br /><span class="hps">•</span> <span class="hps">The</span> <span class="hps">dropout rate</span> <span class="hps">is something that</span> <span class="hps">is best handled</span> <span class="hps">with a design of</span> <span class="hps">sensitive</span> <span class="hps">websites.</span> <span class="hps">Almost all people</span> <span class="hps">who have used</span> <span class="hps">smart phones</span> <span class="hps">and mobile phones</span> <span class="hps">to surf</span> <span class="hps">once</span> <span class="hps">a website</span> <span class="hps">sometime</span> <span class="hps">know which</span> <span class="hps">bounce off</span> <span class="hps">a website.</span> <span class="hps">The small</span>, <span class="hps">hard</span> <span class="hps">point</span> <span class="hps">to understand</span> <span class="hps">images and</span> <span class="hps">a lot of</span> <span class="hps">movement</span> <span class="hps">are the main</span> <span class="hps">reasons why</span> <span class="hps">visitors</span> <span class="hps">do not stay on</span> <span class="hps">a site</span> <span class="hps">for long.</span> <span class="hps">Responsive</span> <span class="hps">Web</span> <span class="hps">Design</span> <span class="hps">allows the</span> <span class="hps">website</span> <span class="hps">are tailored according</span> <span class="hps">to the size</span> <span class="hps">of the screen and</span> <span class="hps">makes it easy</span> <span class="hps">for</span> <span class="hps">the user to use</span> <span class="hps">the website</span> <span class="hps">minimally displaced</span> <span class="hps">and having to deal</span> <span class="hps">with the images</span> <span class="hps">and small</span> <span class="hps">texts.</span> <br /><br /><span class="hps">•</span> <span class="hps">Google</span> <span class="hps">has</span> <span class="hps">been looking</span> <span class="hps">more seriously</span> <span class="hps">the user experience</span> <span class="hps">in the last couple</span> <span class="hps">of years.</span> <span class="hps">One of</span> <span class="hps">the most important aspects</span> <span class="hps">that directly affect</span> <span class="hps">the user experience</span> <span class="hps">is the speed of</span> <span class="hps">loading pages</span> <span class="hps">and</span> <span class="hps">when</span> <span class="hps">the website.</span> <span class="hps">Failure</span> <span class="hps">to redirect</span> <span class="hps">to a mobile</span> <span class="hps">website when you</span> <span class="hps">have a website</span> <span class="hps">optimized for mobile</span> <span class="hps">reduces the</span> <span class="hps">loading time of</span> <span class="hps">website</span> <span class="hps">greatly.</span> <span class="hps">This results in</span> <span class="hps">a better</span> <span class="hps">user experience</span> <span class="hps">and therefore</span> <span class="hps">a happy</span> <span class="hps">Google</span>. <br /><br /><span class="hps">•</span> <span class="hps">Some people might</span> <span class="hps">think that having a</span> <span class="hps">mobile website</span> <span class="hps">and</span> <span class="hps">a separate website</span> <span class="hps">for desktops</span> <span class="hps">is a better choice</span> <span class="hps">when there is a</span> <span class="hps">lot of content</span> <span class="hps">on the website</span>. <span class="hps">However,</span> <span class="hps">they overlook the</span> <span class="hps">fact that a</span> <span class="hps">great</span> <span class="hps">mobile website</span> <span class="hps">must be</span> <span class="hps">built</span> <span class="hps">separately</span> <span class="hps">and</span> <span class="hps">optimized</span> <span class="hps">from scratch</span>. <span class="hps">All</span> <span class="hps">back links and</span> <span class="hps">social media</span> <span class="hps">indicators</span> <span class="hps">will be brought</span> <span class="hps">to zero.</span> <span class="hps">You</span> <span class="hps">have to make a</span> <span class="hps">reputation and</span> <span class="hps">recognition of this</span> <span class="hps">web</span> <span class="hps">site from scratch</span>. <span class="hps">A</span> <span class="hps">responsive web</span> <span class="hps">design</span> <span class="hps">eliminates</span> <span class="hps">this challenge in</span> <span class="hps">his path.</span> <br /><br /><span class="hps">All professionals</span> <span class="hps">and experts in</span> <span class="hps">website designing</span> <span class="hps">agree</span> <span class="hps">that</span> <span class="hps">responsive</span> <span class="hps">web design</span> <span class="hps">is the present and</span> <span class="hps">the future</span> <span class="hps">of web design.</span> <span class="hps">To be</span> <span class="hps">competitive</span> <span class="hps">and</span> <span class="hps">beat your competitors</span>, it is best <span class="hps">that</span> <span class="hps">you go for a</span> <span class="hps">mobile-optimized</span> <span class="hps">website</span> <span class="hps">today</span>.</span></div>
<div dir="ltr" style="zoom: 1;">
<span class="" lang="en"><br /></span></div>
<div dir="ltr" style="zoom: 1;">
<b><a href="http://www.seoservicema.blogspot.com/">Cheap Seo Service Ma</a></b></div>
</div>
</div>
Unknownnoreply@blogger.com3